lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cover.1647360971.git.reinette.chatre@intel.com>
Date:   Tue, 15 Mar 2022 09:44:24 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     shuah@...nel.org, linux-kselftest@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, dave.hansen@...ux.intel.com,
        sandipan@...ux.ibm.com, fweimer@...hat.com,
        desnesn@...ux.vnet.ibm.com, mingo@...nel.org,
        bauerman@...ux.ibm.com, mpe@...erman.id.au, msuchanek@...e.de,
        linux-mm@...ck.org, chang.seok.bae@...el.com, bp@...e.de,
        tglx@...utronix.de, hpa@...or.com, x86@...nel.org, luto@...nel.org
Subject: [PATCH V2 0/4] selftests: Remove duplicate CPUID wrappers

Changes since V1:
- V1: https://lore.kernel.org/lkml/cover.1644000145.git.reinette.chatre@intel.com/
- Change solution to not use __cpuid_count() from compiler's
  cpuid.h but instead use a local define of __cpuid_count()
  provided in kselftest.h to ensure tests continue working
  in all supported environments. (Shuah)
- Rewrite cover letter and changelogs to reflect new solution.

A few tests that require running CPUID do so with a private
implementation of a wrapper for CPUID. This duplication of
the CPUID wrapper should be avoided.

Both gcc and clang/LLVM provide wrappers for CPUID but
the wrappers are not available in the minimal required
version of gcc, v3.2, that the selftests need to be used
in. __cpuid_count() was added to gcc in v4.4, which is ok for
kernels after v4.19 when the gcc minimal required version
was changed to v4.6.

Add a local define of __cpuid_count() to kselftest.h to
ensure that selftests can still work in environments with
older stable kernels (v4.9 and v4.14 that have the minimal
required version of gcc of v3.2). Update tests with private
CPUID wrappers to use the new macro.

Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Sandipan Das <sandipan@...ux.ibm.com>
Cc: Florian Weimer <fweimer@...hat.com>
Cc: "Desnes A. Nunes do Rosario" <desnesn@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Michal Suchanek <msuchanek@...e.de>
Cc: linux-mm@...ck.org
Cc: Chang S. Bae <chang.seok.bae@...el.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: x86@...nel.org
Cc: Andy Lutomirski <luto@...nel.org>

Reinette Chatre (4):
  selftests: Provide local define of __cpuid_count()
  selftests/vm/pkeys: Use provided __cpuid_count() macro
  selftests/x86/amx: Use provided __cpuid_count() macro
  selftests/x86/corrupt_xstate_header: Use provided __cpuid_count()
    macro

 tools/testing/selftests/kselftest.h           | 15 ++++++++++++
 tools/testing/selftests/vm/pkey-x86.h         | 21 ++--------------
 tools/testing/selftests/x86/amx.c             | 24 ++++++-------------
 .../selftests/x86/corrupt_xstate_header.c     | 16 ++-----------
 4 files changed, 26 insertions(+), 50 deletions(-)


base-commit: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ