From: David Hildenbrand <david@redhat.com>
To: John Hubbard <jhubbard@nvidia.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Xu <peterx@redhat.com>, Shuah Khan <shuah@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 07/12] selftests/mm: set -Wno-format-security to avoid uffd build warnings
Date: Fri, 2 Jun 2023 12:15:43 +0200 [thread overview]
Message-ID: <4faf7915-761c-c471-399f-3fcdfc208fd8@redhat.com> (raw)
In-Reply-To: <20230602013358.900637-8-jhubbard@nvidia.com>
On 02.06.23 03:33, John Hubbard wrote:
> The uffd_test_start() is perhaps a little too elaborate about how it
> dispatches tests, leading to a clang warning that looks roughly like
> this:
>
> "uffd-unit-tests.c:1198:20: warning: format string is not a string literal
> (potentially insecure) [-Wformat-security] ...note: treat the string as
> an argument to avoid this.
> uffd_test_start(test_name);
> "
>
> However, it doesn't seem worth it to rewrite the way uffd_test_start()
> works, given that these tests are already deeply unsafe to begin with.
>
> Fix this by just disabling the compiler warning, but only for
> uffd-unit-tests.
>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
> tools/testing/selftests/mm/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
> index 23af4633f0f4..473bf1811552 100644
> --- a/tools/testing/selftests/mm/Makefile
> +++ b/tools/testing/selftests/mm/Makefile
> @@ -170,6 +170,8 @@ $(OUTPUT)/ksm_tests: LDLIBS += -lnuma
>
> $(OUTPUT)/migration: LDLIBS += -lnuma
>
> +$(OUTPUT)/uffd-unit-tests: CFLAGS += -Wno-format-security
> +
> local_config.mk local_config.h: check_config.sh
> /bin/sh ./check_config.sh $(CC)
>
Maybe the following will silence the warning by removing test_name
completely:
---
tools/testing/selftests/mm/uffd-unit-tests.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 269c86768a02..15c76ce972be 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -1149,7 +1149,6 @@ int main(int argc, char *argv[])
uffd_test_case_t *test;
mem_type_t *mem_type;
uffd_test_args_t args;
- char test_name[128];
const char *errmsg;
int has_uffd, opt;
int i, j;
@@ -1192,10 +1191,8 @@ int main(int argc, char *argv[])
mem_type = &mem_types[j];
if (!(test->mem_targets & mem_type->mem_flag))
continue;
- snprintf(test_name, sizeof(test_name),
- "%s on %s", test->name, mem_type->name);
- uffd_test_start(test_name);
+ uffd_test_start("%s on %s", test->name, mem_type->name);
if (!uffd_feature_supported(test)) {
uffd_test_skip("feature missing");
continue;
Still gives me
Testing register-ioctls on anon... done
Testing register-ioctls on shmem... done
Testing register-ioctls on shmem-private... done
Testing register-ioctls on hugetlb... skipped [reason: memory allocation failed]
Testing register-ioctls on hugetlb-private... skipped [reason: memory allocation failed]
...
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-06-02 10:16 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 1:33 [PATCH 00/12] A minor flurry of selftest/mm fixes John Hubbard
2023-06-02 1:33 ` [PATCH 01/12] selftests/mm: fix uffd-stress unused function warning John Hubbard
2023-06-02 9:58 ` David Hildenbrand
2023-06-02 15:25 ` Peter Xu
2023-06-02 1:33 ` [PATCH 02/12] selftests/mm: fix unused variable warning in hugetlb-madvise.c John Hubbard
2023-06-02 10:01 ` David Hildenbrand
2023-06-02 18:38 ` John Hubbard
2023-06-02 1:33 ` [PATCH 03/12] selftests/mm: fix unused variable warning in migration.c John Hubbard
2023-06-02 10:02 ` David Hildenbrand
2023-06-02 18:39 ` John Hubbard
2023-06-02 1:33 ` [PATCH 04/12] selftests/mm: fix a char* assignment in mlock2-tests.c John Hubbard
2023-06-02 10:04 ` David Hildenbrand
2023-06-02 15:24 ` Peter Xu
2023-06-02 18:52 ` John Hubbard
2023-06-05 15:38 ` Peter Xu
2023-06-05 18:45 ` John Hubbard
2023-06-02 1:33 ` [PATCH 05/12] selftests/mm: fix invocation of tests that are run via shell scripts John Hubbard
2023-06-02 10:05 ` David Hildenbrand
2023-06-02 20:38 ` John Hubbard
2023-06-02 15:34 ` Peter Xu
2023-06-02 19:19 ` John Hubbard
2023-06-02 21:36 ` Peter Xu
2023-06-02 21:46 ` John Hubbard
2023-06-02 1:33 ` [PATCH 06/12] selftests/mm: .gitignore: add mkdirty, va_high_addr_switch John Hubbard
2023-06-02 10:06 ` David Hildenbrand
2023-06-02 1:33 ` [PATCH 07/12] selftests/mm: set -Wno-format-security to avoid uffd build warnings John Hubbard
2023-06-02 10:15 ` David Hildenbrand [this message]
2023-06-02 21:22 ` John Hubbard
2023-06-02 1:33 ` [PATCH 08/12] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h John Hubbard
2023-06-02 10:16 ` David Hildenbrand
2023-06-02 1:33 ` [PATCH 09/12] selftests/mm: move psize(), pshift() into vm_utils.c John Hubbard
2023-06-02 10:19 ` David Hildenbrand
2023-06-02 21:58 ` John Hubbard
2023-06-02 1:33 ` [PATCH 10/12] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c John Hubbard
2023-06-02 15:59 ` Peter Xu
2023-06-02 22:11 ` John Hubbard
2023-06-02 22:38 ` Peter Xu
2023-06-02 22:52 ` John Hubbard
2023-06-03 0:43 ` John Hubbard
2023-06-03 1:18 ` Peter Xu
2023-06-03 1:39 ` John Hubbard
2023-06-02 1:33 ` [PATCH 11/12] selftests/mm: fix missing UFFDIO_CONTINUE_MODE_WP and similar build failures John Hubbard
2023-06-02 10:23 ` David Hildenbrand
2023-06-02 22:20 ` John Hubbard
2023-06-03 8:27 ` David Hildenbrand
2023-06-03 23:48 ` John Hubbard
2023-06-02 16:25 ` Muhammad Usama Anjum
2023-06-02 22:24 ` John Hubbard
2023-06-02 1:33 ` [PATCH 12/12] selftests/mm: fix uffd-unit-tests.c build failure due to missing MADV_COLLAPSE John Hubbard
2023-06-02 10:23 ` David Hildenbrand
2023-06-02 16:34 ` Muhammad Usama Anjum
2023-06-02 22:26 ` John Hubbard
2023-06-02 9:32 ` [PATCH 00/12] A minor flurry of selftest/mm fixes David Hildenbrand
2023-06-02 17:51 ` John Hubbard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4faf7915-761c-c471-399f-3fcdfc208fd8@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=peterx@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox