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.1693216959.git.maciej.wieczor-retman@intel.com>
Date:   Mon, 28 Aug 2023 12:48:24 +0200
From:   "Wieczor-Retman, Maciej" <maciej.wieczor-retman@...el.com>
To:     linux-kernel@...r.kernel.org,
        Christian Brauner <brauner@...nel.org>
Cc:     kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-mm@...ck.org, keescook@...omium.org, ndesaulniers@...gle.com,
        coltonlewis@...gle.com, dmatlack@...gle.com, vipinsh@...gle.com,
        seanjc@...gle.com, pbonzini@...hat.com, shuah@...nel.org,
        hannes@...xchg.org, nphamcs@...il.com, reinette.chatre@...el.com,
        ilpo.jarvinen@...ux.intel.com,
        "Wieczor-Retman, Maciej" <maciej.wieczor-retman@...el.com>
Subject: [PATCH 0/6] Add printf attribute to kselftest functions

Kselftest.h declares many variadic functions that can print some
formatted message while also executing selftest logic. These
declarations don't have any compiler mechanism to verify if passed
arguments are valid in comparison with format specifiers used in
printf() calls.

Attribute addition can make debugging easier, the code more consistent
and prevent mismatched or missing variables.

Add a __printf() macro that validates types of variables passed to the
format string. The macro is similiarly used in other tools in the kernel.

Add __printf() attributes to function definitions inside kselftest.h that
use printing.

Adding the __printf() macro exposes some mismatches in format strings
across different selftests.

Fix the mismatched format specifiers in multiple tests.

Wieczor-Retman, Maciej (6):
  selftests: Add printf attribute to ksefltest prints
  selftests/cachestat: Fix print_cachestat format
  selftests/openat2: Fix wrong format specifier
  selftests/pidfd: Fix ksft print formats
  selftests/sigaltstack: Fix wrong format specifier
  selftests/kvm: Replace attribute with macro

 .../selftests/cachestat/test_cachestat.c       |  2 +-
 tools/testing/selftests/kselftest.h            | 18 ++++++++++--------
 .../testing/selftests/kvm/include/test_util.h  |  2 +-
 tools/testing/selftests/openat2/openat2_test.c |  2 +-
 .../selftests/pidfd/pidfd_fdinfo_test.c        |  2 +-
 tools/testing/selftests/pidfd/pidfd_test.c     | 12 ++++++------
 tools/testing/selftests/sigaltstack/sas.c      |  2 +-
 7 files changed, 21 insertions(+), 19 deletions(-)


base-commit: 13eb52f6293dbda02890698d92f3d9913d8d5aeb
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ