From patchwork Fri Dec 2 11:09:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 120436 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 177F1A0542; Fri, 2 Dec 2022 12:10:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4F6040687; Fri, 2 Dec 2022 12:10:02 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 841AD400D6 for ; Fri, 2 Dec 2022 12:10:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669979400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l/+1vdSWCx9pcTfg4n2QYMxN9m2B8gbfKnlpAGuRNCE=; b=O8WIoSEsGqnldKL0nH0H+YgIPVDyjkNWjf45/80PaGFFPxZHCH8b4l0Qup2SA8v0U6Sq9C +M++teRhmrJFu6bJP5mBvqy22FQzaUffR4FbTEmQThQ0V+qSjk5OnqoSkOYLXWTe5UXmuS gq7AJgn8wnF47vLt2z3jESpszDfiAoM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-246-c8ad888pPbKzgr5IilUNzA-1; Fri, 02 Dec 2022 06:09:57 -0500 X-MC-Unique: c8ad888pPbKzgr5IilUNzA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5BFF3101A528; Fri, 2 Dec 2022 11:09:57 +0000 (UTC) Received: from localhost.localdomain (ovpn-192-86.brq.redhat.com [10.40.192.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D9C140C947B; Fri, 2 Dec 2022 11:09:54 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: ferruh.yigit@amd.com, stable@dpdk.org, Luca Boccassi , Bruce Richardson , Aaron Conole , Michael Santana , Thomas Monjalon , =?utf-8?b?QWJkdWxsYWggw5ZtZXIgWWFt?= =?utf-8?b?YcOn?= Subject: [PATCH v4 1/2] drivers: fix symbol exports when map is omitted Date: Fri, 2 Dec 2022 12:09:43 +0100 Message-Id: <20221202110945.519708-1-david.marchand@redhat.com> In-Reply-To: <20221129140032.35940-1-david.marchand@redhat.com> References: <20221129140032.35940-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org ld exports any global symbol by default if no version script is passed. As a consequence, the incriminated change let any public symbol leak out of the driver shared libraries. Hide again those symbols by providing a default map file which unexports any global symbol using a local: * catch-all statement. The checks are skipped for this default map file as it is intentionnally an empty map (see commit b67bdda86cd4 ("devtools: catch empty symbol maps")) and there is nothing else to check in this map. This change impacts the exported symbols, hence, bump the version in the ABI check to the v22.11.1 from the 22.11 LTS branch. Fixes: 7dde9c844a37 ("drivers: omit symbol map when unneeded") Cc: stable@dpdk.org Reported-by: Luca Boccassi Signed-off-by: David Marchand Tested-by: Ferruh Yigit Reviewed-by: Bruce Richardson Acked-by: Aaron Conole --- Changes since v3: - updated ABI reference now that 22.11.1 is released, Changes since v2: - separated the Windows cleanup in next patch, Changes since v1: - excluded drivers/version.map from maps checked by default in check-symbol-maps.sh, --- .github/workflows/build.yml | 3 +- .travis.yml | 3 +- devtools/check-symbol-maps.sh | 2 +- drivers/meson.build | 68 +++++++++++++++++++---------------- drivers/version.map | 3 ++ 5 files changed, 45 insertions(+), 34 deletions(-) create mode 100644 drivers/version.map diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9527ad1f8c..6bad94098e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,8 @@ jobs: MINGW: ${{ matrix.config.cross == 'mingw' }} MINI: ${{ matrix.config.mini != '' }} PPC64LE: ${{ matrix.config.cross == 'ppc64le' }} - REF_GIT_TAG: v22.11 + REF_GIT_REPO: https://dpdk.org/git/dpdk-stable + REF_GIT_TAG: v22.11.1 RISCV64: ${{ matrix.config.cross == 'riscv64' }} RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }} diff --git a/.travis.yml b/.travis.yml index b99444620f..0936788dc7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,8 @@ script: ./.ci/${TRAVIS_OS_NAME}-build.sh env: global: - LIBABIGAIL_VERSION=libabigail-2.1 - - REF_GIT_TAG=v22.11 + - REF_GIT_REPO=https://dpdk.org/git/dpdk-stable + - REF_GIT_TAG=v22.11.1 jobs: include: diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh index 0a6062de26..8c116bfa9c 100755 --- a/devtools/check-symbol-maps.sh +++ b/devtools/check-symbol-maps.sh @@ -8,7 +8,7 @@ cd $(dirname $0)/.. export LC_ALL=C if [ $# = 0 ] ; then - set -- $(find lib drivers -name '*.map') + set -- $(find lib drivers -name '*.map' -a ! -path drivers/version.map) fi ret=0 diff --git a/drivers/meson.build b/drivers/meson.build index c4ff3ff1ba..5188302057 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -210,40 +210,46 @@ foreach subpath:subdirs lk_deps = [] lk_args = [] - if fs.is_file(version_map) - def_file = custom_target(lib_name + '_def', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_exports.def'.format(lib_name)) - - mingw_map = custom_target(lib_name + '_mingw', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_mingw.map'.format(lib_name)) - - lk_deps = [version_map, def_file, mingw_map] - if is_windows - if is_ms_linker - lk_args = ['-Wl,/def:' + def_file.full_path()] - if meson.version().version_compare('<0.54.0') - lk_args += ['-Wl,/implib:drivers\\' + implib] - endif - else - lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] + if not fs.is_file(version_map) + version_map = '@0@/version.map'.format(meson.current_source_dir()) + lk_deps += [version_map] + else + lk_deps += [version_map] + if not is_windows and developer_mode + # on unix systems check the output of the + # check-symbols.sh script, using it as a + # dependency of the .so build + lk_deps += custom_target(lib_name + '.sym_chk', + command: [check_symbols, version_map, '@INPUT@'], + capture: true, + input: static_lib, + output: lib_name + '.sym_chk') + endif + endif + + def_file = custom_target(lib_name + '_def', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_exports.def'.format(lib_name)) + + mingw_map = custom_target(lib_name + '_mingw', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_mingw.map'.format(lib_name)) + + lk_deps += [def_file, mingw_map] + + if is_windows + if is_ms_linker + lk_args = ['-Wl,/def:' + def_file.full_path()] + if meson.version().version_compare('<0.54.0') + lk_args += ['-Wl,/implib:drivers\\' + implib] endif else - lk_args = ['-Wl,--version-script=' + version_map] - if developer_mode - # on unix systems check the output of the - # check-symbols.sh script, using it as a - # dependency of the .so build - lk_deps += custom_target(lib_name + '.sym_chk', - command: [check_symbols, version_map, '@INPUT@'], - capture: true, - input: static_lib, - output: lib_name + '.sym_chk') - endif + lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] endif + else + lk_args = ['-Wl,--version-script=' + version_map] endif shared_lib = shared_library(lib_name, sources, diff --git a/drivers/version.map b/drivers/version.map new file mode 100644 index 0000000000..78c3585d7c --- /dev/null +++ b/drivers/version.map @@ -0,0 +1,3 @@ +DPDK_23 { + local: *; +}; From patchwork Fri Dec 2 11:09:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 120437 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12736A0542; Fri, 2 Dec 2022 12:10:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0BD042B8C; Fri, 2 Dec 2022 12:10:05 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0374342B8C for ; Fri, 2 Dec 2022 12:10:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669979403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4EA9zsjk5pcTlHYepDCNcdjwhk3VDozWztWRtV5dlHg=; b=XsSgIpeq6YOZGIiP5GBHXvIThLoRaU+UTenzW4aoNq6IUCQ3eljQx7whNkeD/peGjuSG99 oN890Gle6BSJM+GG8oxCb7KetRk7//0wzSfAOHD38kf4P3063OfB+S/r5oIzhaVaVK2DRs PSQVhWgIIvuGo0VLI0hp/e7kqiSqnck= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-522-9cJJxlCwPrm1Vd44w50DoA-1; Fri, 02 Dec 2022 06:10:00 -0500 X-MC-Unique: 9cJJxlCwPrm1Vd44w50DoA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32B83811E84; Fri, 2 Dec 2022 11:10:00 +0000 (UTC) Received: from localhost.localdomain (ovpn-192-86.brq.redhat.com [10.40.192.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61CB3111E3EA; Fri, 2 Dec 2022 11:09:59 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Bruce Richardson Subject: [PATCH v4 2/2] build: generate Windows build artefacts when needed Date: Fri, 2 Dec 2022 12:09:44 +0100 Message-Id: <20221202110945.519708-2-david.marchand@redhat.com> In-Reply-To: <20221202110945.519708-1-david.marchand@redhat.com> References: <20221129140032.35940-1-david.marchand@redhat.com> <20221202110945.519708-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org We have been generating some Windows and mingw artefacts on all OS while there is no need for them. Signed-off-by: David Marchand Reviewed-by: Bruce Richardson --- drivers/meson.build | 27 +++++++++++++-------------- lib/meson.build | 29 +++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index 5188302057..c6d619200f 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -206,7 +206,6 @@ foreach subpath:subdirs # now build the shared driver version_map = '@0@/@1@/version.map'.format(meson.current_source_dir(), drv_path) - implib = 'lib' + lib_name + '.dll.a' lk_deps = [] lk_args = [] @@ -227,25 +226,25 @@ foreach subpath:subdirs endif endif - def_file = custom_target(lib_name + '_def', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_exports.def'.format(lib_name)) - - mingw_map = custom_target(lib_name + '_mingw', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_mingw.map'.format(lib_name)) - - lk_deps += [def_file, mingw_map] - if is_windows if is_ms_linker + def_file = custom_target(lib_name + '_def', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_exports.def'.format(lib_name)) + lk_deps += [def_file] + lk_args = ['-Wl,/def:' + def_file.full_path()] if meson.version().version_compare('<0.54.0') - lk_args += ['-Wl,/implib:drivers\\' + implib] + lk_args += ['-Wl,/implib:drivers\\lib' + lib_name + '.dll.a'] endif else + mingw_map = custom_target(lib_name + '_mingw', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_mingw.map'.format(lib_name)) + lk_deps += [mingw_map] + lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] endif else diff --git a/lib/meson.build b/lib/meson.build index fd55925340..a90fee31b7 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -224,34 +224,35 @@ foreach l:libraries # RTE_BUILD_SHARED_LIB defined cflags += '-DRTE_BUILD_SHARED_LIB' endif - version_map = '@0@/@1@/version.map'.format( - meson.current_source_dir(), l) - implib = 'librte_' + l + '.dll.a' - def_file = custom_target(libname + '_def', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_exports.def'.format(libname)) - - mingw_map = custom_target(libname + '_mingw', - command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], - input: version_map, - output: '@0@_mingw.map'.format(libname)) + version_map = '@0@/@1@/version.map'.format(meson.current_source_dir(), l) + lk_deps = [version_map] if is_ms_linker + def_file = custom_target(libname + '_def', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_exports.def'.format(libname)) + lk_deps += [def_file] + lk_args = ['-Wl,/def:' + def_file.full_path()] if meson.version().version_compare('<0.54.0') - lk_args += ['-Wl,/implib:lib\\' + implib] + lk_args += ['-Wl,/implib:lib\\librte_' + l + '.dll.a'] endif else if is_windows + mingw_map = custom_target(libname + '_mingw', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_mingw.map'.format(libname)) + lk_deps += [mingw_map] + lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] else lk_args = ['-Wl,--version-script=' + version_map] endif endif - lk_deps = [version_map, def_file, mingw_map] if developer_mode and not is_windows # on unix systems check the output of the # check-symbols.sh script, using it as a