From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3DA003858403; Mon, 12 Feb 2024 21:11:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DA003858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707772298; bh=IF+nqIe3wyqfUkl7OEwWVpc+ka+gMbQtYDqtCN+Gync=; h=From:To:Subject:Date:From; b=iWkQC2dcniQ0O0mCjWchsQcMlMeGj3B1R0OouZe9cN6nzp5AIggOJyvcvFiW2QA9K 5tRRnOxEaJJgIK1b+vquWo4UsSSe9yO/ONtjfo7FPzmN6IXBvjSyTATGpoM4Z5EWKb +txLwuwCyw5FJrbSlsR5sv7n1fryUvN0iVOygdqw= From: "wcohen at redhat dot com" To: systemtap@sourceware.org Subject: [Bug runtime/31373] New: Allow systemtap to work on kernels without strlcpy (removed in the linux-6.8.0-rc3 kernels) Date: Mon, 12 Feb 2024 21:11:37 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31373 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 2024-01-18 15:31:55 Committer: Kees Cook 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 Cc: Andrew Morton Cc: Andy Whitcroft Cc: Joe Perches Cc: Dwaipayan Ray Cc: Lukas Bulwahn Cc: linux-hardening@vger.kernel.org Reviewed-by: Andy Shevchenko Signed-off-by: Kees Cook 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 =E2=80=98_stp_text_str=E2=80=99: /home/wcohen/systemtap_write/install/share/systemtap/runtime/stp_string.c:3= 04:9: error: implicit declaration of function =E2=80=98strlcpy=E2=80=99; did you = mean =E2=80=98strscpy=E2=80=99? [-Wimplicit-function-declaration] 304 | strlcpy (outstr, "", 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 ca= lls in the tapset directory and some of the *.cxx files. There is some discuss= ion about the move from strlcpy to strscpy in https://lwn.net/Articles/659214/ = .=20=20 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 be= ing 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. --=20 You are receiving this mail because: You are the assignee for the bug.=