From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-hardening@vger.kernel.org, Kees Cook <kees@kernel.org>,
Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v1 0/4] Add streq(3), and use it to replace confusing uses of strncmp(3)
Date: Mon, 23 Nov 2026 14:43:59 +0100 [thread overview]
Message-ID: <awRCZ8plu5l0AwyV@devuan> (raw)
In-Reply-To: <cover.1794767906.git.alx@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 9036 bytes --]
Hi!
Just a gentle ping on this patch. It didn't seem to get any feedback,
which I take as something good (no important issues with it, I guess),
since the patch is quite simple.
I've never done a tree-wide change like this, so I don't know if it's
okay as is, or if I should split the tree-wide patch into small patches
for each subsystem (and where are the boundaries). Any advice?
Have a lovely day!
Alex
> Date: 2026-11-15 19:46:10+0100
> From: Alejandro Colomar <alx@kernel.org>
>
> Hi!
>
> This is a spin off from the patch set that adds strprefix()[1].
> This patch set replaces some uses of strncmp(3), so that later the
> strprefix() patch set is easier to apply.
>
> [1]: <https://lore.kernel.org/linux-hardening/cover.1794667407.git.alx@kernel.org/T/>
>
> This patch set doesn't replace strcmp(3) with streq(3), since there are
> thousands of those, and those are less important now. The strncmp(3)
> ones are the most important, because they can be easily confused with
> strprefix().
>
> Testing
> ~~~~~~~
>
> (I've indented the output, to better see the commands.)
>
> $ git log --oneline --graph v7.4-rc1^..streq1
> * 7994b5827030 (HEAD -> streq, tag: streq1) treewide: Use streq(3) instead of unnecessary uses of strncmp(3)
> * b93e0d005739 treewide: Use streq(3) instead of confusing uses of strncmp(3)
> * 1715e2c9c8ea tools/: Add streq() to nolibc/string
> * ad8500a6eb0a string: Add streq()
> * 6628e7d4c6b2 (tag: v7.4-rc1, master) Linux 7.4-rc1
> $ cp ../kunitconfig .kunitconfig
> $ cat .kunitconfig
> CONFIG_KUNIT=y
> CONFIG_STRING_KUNIT_TEST=y
> $ mkdir -p ~/tmp/streq1
> $ export TMPDIR=$HOME/tmp/streq1/
> $ ./tools/testing/kunit/kunit.py run "string*"
> [18:45:10] Configuring KUnit Kernel ...
> Generating .config ...
> Populating config with:
> $ make ARCH=um O=.kunit olddefconfig
> [18:45:14] Building KUnit Kernel ...
> Populating config with:
> $ make ARCH=um O=.kunit olddefconfig
> Building with:
> $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=24
> [18:45:30] Starting KUnit Kernel (1/1)...
> [18:45:30] ============================================================
> Running tests with:
> $ .kunit/linux 'kunit.filter_glob=string*' kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
> [18:45:30] ============= string-stream-test (12 subtests) =============
> [18:45:30] [PASSED] string_stream_managed_init_test
> [18:45:30] [PASSED] string_stream_unmanaged_init_test
> [18:45:30] [PASSED] string_stream_managed_free_test
> [18:45:30] [PASSED] string_stream_resource_free_test
> [18:45:30] [PASSED] string_stream_line_add_test
> [18:45:30] [PASSED] string_stream_variable_length_line_test
> [18:45:30] [PASSED] string_stream_append_test
> [18:45:30] [PASSED] string_stream_append_auto_newline_test
> [18:45:30] [PASSED] string_stream_append_empty_string_test
> [18:45:30] [PASSED] string_stream_no_auto_newline_test
> [18:45:30] [PASSED] string_stream_auto_newline_test
> [18:45:30] [PASSED] string_stream_performance_test
> [18:45:30] =============== [PASSED] string-stream-test ================
> [18:45:30] =================== string (29 subtests) ===================
> [18:45:30] [PASSED] string_test_memset16
> [18:45:30] [PASSED] string_test_memset32
> [18:45:30] [PASSED] string_test_memset64
> [18:45:30] [PASSED] string_test_strlen
> [18:45:30] [PASSED] string_test_strnlen
> [18:45:30] [PASSED] string_test_strchr
> [18:45:30] [PASSED] string_test_strnchr
> [18:45:30] [PASSED] string_test_strrchr
> [18:45:30] [PASSED] string_test_strspn
> [18:45:30] [PASSED] string_test_streq
> [18:45:30] [PASSED] string_test_strcmp
> [18:45:30] [PASSED] string_test_strcmp_long_strings
> [18:45:30] [PASSED] string_test_strncmp
> [18:45:30] [PASSED] string_test_strncmp_long_strings
> [18:45:30] [PASSED] string_test_strcasecmp
> [18:45:30] [PASSED] string_test_strcasecmp_long_strings
> [18:45:30] [PASSED] string_test_strncasecmp
> [18:45:30] [PASSED] string_test_strncasecmp_long_strings
> [18:45:30] [PASSED] string_test_strscpy
> [18:45:30] [PASSED] string_test_strcat
> [18:45:30] [PASSED] string_test_strncat
> [18:45:30] [PASSED] string_test_strlcat
> [18:45:30] [PASSED] string_test_strtomem
> [18:45:30] [PASSED] string_test_memtostr
> [18:45:30] [PASSED] string_test_strends
> [18:45:30] [SKIPPED] string_bench_strlen (not enabled)
> [18:45:30] [SKIPPED] string_bench_strnlen (not enabled)
> [18:45:30] [SKIPPED] string_bench_strchr (not enabled)
> [18:45:30] [SKIPPED] string_bench_strrchr (not enabled)
> [18:45:30] ===================== [PASSED] string ======================
> [18:45:30] =============== string_helpers (4 subtests) ================
> [18:45:30] [PASSED] test_get_size
> [18:45:30] [PASSED] test_upper_lower
> [18:45:30] [PASSED] test_unescape
> [18:45:30] [PASSED] test_escape
> [18:45:30] ================= [PASSED] string_helpers ==================
> [18:45:30] ============================================================
> [18:45:30] Testing complete. Ran 45 tests: passed: 41, skipped: 4
> [18:45:30] Elapsed time: 19.736s total, 3.261s configuring, 16.309s building, 0.162s running
>
> $ make allmodconfig
> HOSTCC scripts/basic/fixdep
> HOSTCC scripts/kconfig/conf.o
> HOSTCC scripts/kconfig/confdata.o
> HOSTCC scripts/kconfig/expr.o
> LEX scripts/kconfig/lexer.lex.c
> YACC scripts/kconfig/parser.tab.[ch]
> HOSTCC scripts/kconfig/lexer.lex.o
> HOSTCC scripts/kconfig/menu.o
> HOSTCC scripts/kconfig/parser.tab.o
> HOSTCC scripts/kconfig/preprocess.o
> HOSTCC scripts/kconfig/symbol.o
> HOSTCC scripts/kconfig/util.o
> HOSTLD scripts/kconfig/conf
> #
> # configuration written to .config
> #
> $ time make -j24 | ts -s
> 00:00:00 GEN arch/x86/include/generated/asm/orc_hash.h
> 00:00:00 UPD arch/x86/include/generated/uapi/asm/bpf_perf_event.h
> 00:00:00 UPD arch/x86/include/generated/uapi/asm/errno.h
> ...
> 00:20:03 LD [M] net/qrtr/qrtr-tun.ko
> 00:20:03 LD [M] net/qrtr/qrtr-mhi.ko
> 00:20:03 LD [M] virt/lib/irqbypass.ko
>
> real 20m3.221s
> user 425m2.307s
> sys 25m40.226s
>
>
> Have a lovely night!
> Alex
>
>
> Alejandro Colomar (4):
> string: Add streq()
> tools/: Add streq() to nolibc/string
> treewide: Use streq(3) instead of confusing uses of strncmp(3)
> treewide: Use streq(3) instead of unnecessary uses of strncmp(3)
>
> arch/arm/mach-omap2/sr_device.c | 8 ++++----
> arch/m68k/sun3/prom/console.c | 6 +++---
> arch/mips/bcm47xx/time.c | 2 +-
> arch/powerpc/kernel/security.c | 2 +-
> drivers/clk/socfpga/clk-gate-a10.c | 2 --
> drivers/clk/socfpga/clk.h | 1 -
> drivers/edac/amd64_edac.c | 2 +-
> drivers/edac/i10nm_base.c | 2 +-
> drivers/edac/igen6_edac.c | 2 +-
> drivers/edac/imh_base.c | 2 +-
> drivers/edac/pnd2_edac.c | 2 +-
> drivers/edac/sb_edac.c | 2 +-
> drivers/edac/skx_base.c | 2 +-
> drivers/gpu/drm/tilcdc/tilcdc_panel_legacy.c | 2 +-
> drivers/net/ethernet/intel/i40e/i40e_ddp.c | 2 +-
> fs/ocfs2/filecheck.c | 6 +++---
> include/linux/remoteproc/pruss.h | 2 +-
> include/linux/string.h | 12 ++++++++++++
> lib/tests/string_kunit.c | 13 +++++++++++++
> net/netfilter/xt_set.c | 2 +-
> sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 2 +-
> tools/bpf/bpftool/btf.c | 4 ++--
> tools/include/nolibc/string.h | 2 ++
> tools/perf/util/callchain.c | 8 ++++----
> tools/perf/util/evsel.c | 3 +--
> tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 8 ++++----
> tools/testing/selftests/kvm/steal_time.c | 2 +-
> tools/testing/selftests/kvm/x86/xen_shinfo_test.c | 4 ++--
> tools/testing/selftests/proc/proc-subset-pid.c | 5 -----
> tools/testing/selftests/proc/proc.h | 5 -----
> 30 files changed, 65 insertions(+), 52 deletions(-)
>
> Range-diff against v0:
> -: ------------ > 1: ad8500a6eb0a string: Add streq()
> -: ------------ > 2: 1715e2c9c8ea tools/: Add streq() to nolibc/string
> -: ------------ > 3: b93e0d005739 treewide: Use streq(3) instead of confusing uses of strncmp(3)
> -: ------------ > 4: 7994b5827030 treewide: Use streq(3) instead of unnecessary uses of strncmp(3)
> --
> 2.55.0
>
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-23 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 18:46 [PATCH v1 0/4] Add streq(3), and use it to replace confusing uses of strncmp(3) Alejandro Colomar
2026-11-15 18:46 ` [PATCH v1 1/4] string: Add streq() Alejandro Colomar
2026-11-15 18:46 ` [PATCH v1 2/4] tools/: Add streq() to nolibc/string Alejandro Colomar
2026-11-15 18:46 ` [PATCH v1 3/4] treewide: Use streq(3) instead of confusing uses of strncmp(3) Alejandro Colomar
2026-11-15 18:46 ` [PATCH v1 4/4] treewide: Use streq(3) instead of unnecessary " Alejandro Colomar
2026-11-16 12:25 ` Andy Shevchenko
2026-11-16 12:44 ` Alejandro Colomar
2026-11-23 13:43 ` Alejandro Colomar [this message]
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=awRCZ8plu5l0AwyV@devuan \
--to=alx+linux-hardening@kernel.org \
--cc=alx@kernel.org \
--cc=andy@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.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