* [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) @ 2024-02-12 21:11 wcohen at redhat dot com 2024-02-12 22:58 ` [Bug runtime/31373] " fche at redhat dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: wcohen at redhat dot com @ 2024-02-12 21:11 UTC (permalink / raw) To: systemtap https://sourceware.org/bugzilla/show_bug.cgi?id=31373 Bug ID: 31373 Summary: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) Product: systemtap Version: unspecified Status: NEW Severity: normal Priority: P2 Component: runtime Assignee: systemtap at sourceware dot org Reporter: wcohen at redhat dot com Target Milestone: --- The latest linux kernels have removed strlcpy with kernel git commit d26270061ae66b915138af7cd73ca6f8b85e6b44 : Author: Kees Cook <keescook@chromium.org> 2024-01-18 15:31:55 Committer: Kees Cook <keescook@chromium.org> 2024-01-19 14:59:11 Parent: e28b0359587fe4055c838698172de0530b511702 (bcachefs: Replace strlcpy() with strscpy()) Child: 57f22c8dab6b266ae36b89b073a4a33dea71e762 (Merge tag 'strlcpy-removal-v6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux) Branches: master, remotes/origin/master Follows: v6.7 Precedes: v6.8-rc1 string: Remove strlcpy() With all the users of strlcpy() removed[1] from the kernel, remove the API, self-tests, and other references. Leave mentions in Documentation (about its deprecation), and in checkpatch.pl (to help migrate host-only tools/ usage). Long live strscpy(). Link: https://github.com/KSPP/linux/issues/89 [1] Cc: Azeem Shaikh <azeemshaikh38@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Cc: linux-hardening@vger.kernel.org Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Without the strlcpy function in the kernel systemtap scripts fail to build as seen below: $ ../install/bin/stap -p4 testsuite/systemtap.examples/general/ansi_colors.stp In file included from /home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/runtime.h:325, from /home/wcohen/systemtap_write/install/share/systemtap/runtime/runtime.h:26, from /tmp/stapBVBodh/stap_a3ae1fd74dcbac47ca75cf2713720668_2212_src.c:21: /home/wcohen/systemtap_write/install/share/systemtap/runtime/stp_string.c: In function ‘_stp_text_str’: /home/wcohen/systemtap_write/install/share/systemtap/runtime/stp_string.c:304:9: error: implicit declaration of function ‘strlcpy’; did you mean ‘strscpy’? [-Wimplicit-function-declaration] 304 | strlcpy (outstr, "<unknown>", outlen); | ^~~~~~~ | strscpy make[1]: *** [scripts/Makefile.build:243: /tmp/stapBVBodh/stap_a3ae1fd74dcbac47ca75cf2713720668_2212_src.o] Error 1 make: *** [Makefile:1939: /tmp/stapBVBodh] Error 2 WARNING: kbuild exited with status: 2 Pass 4: compilation failed. [man error::pass4] Kernel version 6.8.0 is outside tested range 2.6.32 ... 6.8-rc0 See a number of strlcpy in runtime directory, but there are also strscpy calls in the tapset directory and some of the *.cxx files. There is some discussion about the move from strlcpy to strscpy in https://lwn.net/Articles/659214/ . One thing to note is that strlcpy and strscpy have different return value semantics and there are some places where the return value of strlcpy is being used. The strscpy function was added to the linux kernel with git commit 30035e45753b708e7d47a98398500ca005e02b86 around 2015-04-29 and is available in Linux 4.3 and newer kernels. -- You are receiving this mail because: You are the assignee for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/31373] Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) 2024-02-12 21:11 [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) wcohen at redhat dot com @ 2024-02-12 22:58 ` fche at redhat dot com 2024-02-13 14:17 ` wcohen at redhat dot com ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: fche at redhat dot com @ 2024-02-12 22:58 UTC (permalink / raw) To: systemtap https://sourceware.org/bugzilla/show_bug.cgi?id=31373 Frank Ch. Eigler <fche at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fche at redhat dot com --- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> --- In our case, with trusted inputs / lengths, it may be enough to #define strlcpy strscpy -- You are receiving this mail because: You are the assignee for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/31373] Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) 2024-02-12 21:11 [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) wcohen at redhat dot com 2024-02-12 22:58 ` [Bug runtime/31373] " fche at redhat dot com @ 2024-02-13 14:17 ` wcohen at redhat dot com 2024-02-13 15:31 ` wcohen at redhat dot com 2024-02-14 14:46 ` wcohen at redhat dot com 3 siblings, 0 replies; 5+ messages in thread From: wcohen at redhat dot com @ 2024-02-13 14:17 UTC (permalink / raw) To: systemtap https://sourceware.org/bugzilla/show_bug.cgi?id=31373 --- Comment #2 from William Cohen <wcohen at redhat dot com> --- Created attachment 15361 --> https://sourceware.org/bugzilla/attachment.cgi?id=15361&action=edit Proposed define to map the strlcpy to strscpy The suggestion was the approach that this patch is taking. However, there are some places in the generated code that make use of the return value to track the amount of buffer space used by the operation. The proposed patch adjusts the strscpy return value to make it compatible with the existing uses of the strlcpy return value. The macro definition need to be placed where it is only used by the systemtap generated module. Currently it pulled into code for code for the dyninst target and causes the dyninst target code to not compile.. -- You are receiving this mail because: You are the assignee for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/31373] Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) 2024-02-12 21:11 [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) wcohen at redhat dot com 2024-02-12 22:58 ` [Bug runtime/31373] " fche at redhat dot com 2024-02-13 14:17 ` wcohen at redhat dot com @ 2024-02-13 15:31 ` wcohen at redhat dot com 2024-02-14 14:46 ` wcohen at redhat dot com 3 siblings, 0 replies; 5+ messages in thread From: wcohen at redhat dot com @ 2024-02-13 15:31 UTC (permalink / raw) To: systemtap https://sourceware.org/bugzilla/show_bug.cgi?id=31373 --- Comment #3 from William Cohen <wcohen at redhat dot com> --- Created attachment 15362 --> https://sourceware.org/bugzilla/attachment.cgi?id=15362&action=edit Revised patch with macro where only systemtap kernel modules use it. Looked around runtime code. Found a place in runtime/linux where <linux/string.h> is included and placed the macro after that to ensure had the strscpy declaration. Tried the patch out and systemtap dyninst backend tests are working. -- You are receiving this mail because: You are the assignee for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/31373] Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) 2024-02-12 21:11 [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) wcohen at redhat dot com ` (2 preceding siblings ...) 2024-02-13 15:31 ` wcohen at redhat dot com @ 2024-02-14 14:46 ` wcohen at redhat dot com 3 siblings, 0 replies; 5+ messages in thread From: wcohen at redhat dot com @ 2024-02-14 14:46 UTC (permalink / raw) To: systemtap https://sourceware.org/bugzilla/show_bug.cgi?id=31373 William Cohen <wcohen at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #4 from William Cohen <wcohen at redhat dot com> --- This has been addressed by git commit 60c3d8b1c90c58ca7c048ef24e1b03c6c04b36ad. -- You are receiving this mail because: You are the assignee for the bug. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-14 14:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-02-12 21:11 [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) wcohen at redhat dot com 2024-02-12 22:58 ` [Bug runtime/31373] " fche at redhat dot com 2024-02-13 14:17 ` wcohen at redhat dot com 2024-02-13 15:31 ` wcohen at redhat dot com 2024-02-14 14:46 ` wcohen at redhat dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).