* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
@ 2022-04-20 14:48 ` wcohen at redhat dot com
2022-04-20 14:48 ` wcohen at redhat dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wcohen at redhat dot com @ 2022-04-20 14:48 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
Tried the example on non-x86 platforms such as aarch64 and it gave the expected
result:
[wcohen@fedora ~]$ uname -a
Linux fedora 5.16.20-200.fc35.aarch64 #1 SMP Wed Apr 13 21:49:21 UTC 2022
aarch64 aarch64 aarch64 GNU/Linux
[wcohen@fedora ~]$ gcc -o acct2 -O2 acct2.c
[wcohen@fedora ~]$ sudo stap -c ./acct2 sys_acct.stp
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
You are using: gcc (GCC) 11.2.1 20220401 (Red Hat 11.2.1-10)
kprobe.function("__arm64_sys_acct")?("foobar")
kprobe.function("__arm64_sys_acct")?("foobar")
kprobe.function("__arm64_sys_acct")?(0xffffffffffffffff)
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
2022-04-20 14:48 ` [Bug runtime/29076] " wcohen at redhat dot com
@ 2022-04-20 14:48 ` wcohen at redhat dot com
2022-04-20 14:48 ` fche at redhat dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wcohen at redhat dot com @ 2022-04-20 14:48 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
William Cohen <wcohen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mcermak at redhat dot com
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
2022-04-20 14:48 ` [Bug runtime/29076] " wcohen at redhat dot com
2022-04-20 14:48 ` wcohen at redhat dot com
@ 2022-04-20 14:48 ` fche at redhat dot com
2022-04-20 17:37 ` wcohen at redhat dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2022-04-20 14:48 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> ---
Could this simply be a paging issue? Or does the test case cause the rodata
bits to be properly paged in, before the test syscalls are fired? Maybe it
should call mlockall() at startup.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
` (2 preceding siblings ...)
2022-04-20 14:48 ` fche at redhat dot com
@ 2022-04-20 17:37 ` wcohen at redhat dot com
2022-04-20 18:02 ` fche at redhat dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wcohen at redhat dot com @ 2022-04-20 17:37 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
That appears to be the case on x86_64. The question is how to get the syscall
tests to work better. Have two examples that only differ with where the strcpy
is done. One result has a pointer and the other prints the string:
[wcohen@fedora x86_ro_string]$ cat acct4.c
#include <unistd.h>
#include <string.h>
char *a="foobar";
char buffer[32];
int main()
{
acct(a);
strcpy (&buffer[0], a);
acct(&buffer[0]);
acct((char *)-1);
return 0;
}
[wcohen@fedora x86_ro_string]$ gcc -o acct5 -O2 acct5.c
[wcohen@fedora x86_ro_string]$ sudo stap -c ./acct4 sys_acct.stp
[sudo] password for wcohen:
kprobe.function("__x64_sys_acct")?(0x402010)
kprobe.function("__x64_sys_acct")?("foobar")
kprobe.function("__x64_sys_acct")?(0xffffffffffffffff)
[wcohen@fedora x86_ro_string]$ cat acct5.c
#include <unistd.h>
#include <string.h>
char *a="foobar";
char buffer[32];
int main()
{
strcpy (&buffer[0], a);
acct(a);
acct(&buffer[0]);
acct((char *)-1);
return 0;
}
[wcohen@fedora x86_ro_string]$ gcc -o acct5 -O2 acct5.c
[wcohen@fedora x86_ro_string]$ sudo stap -c ./acct5 sys_acct.stp
kprobe.function("__x64_sys_acct")?("foobar")
kprobe.function("__x64_sys_acct")?("foobar")
kprobe.function("__x64_sys_acct")?(0xffffffffffffffff)
[wcohen@fedora x86_ro_string]$
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
` (3 preceding siblings ...)
2022-04-20 17:37 ` wcohen at redhat dot com
@ 2022-04-20 18:02 ` fche at redhat dot com
2022-04-20 18:17 ` wcohen at redhat dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fche at redhat dot com @ 2022-04-20 18:02 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fche at redhat dot com
--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> ---
OK, that seems to confirm it's just demand-paging artifact.
Try adding an mlockall(MCL_CURRENT) syscall at the top of main().
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
` (4 preceding siblings ...)
2022-04-20 18:02 ` fche at redhat dot com
@ 2022-04-20 18:17 ` wcohen at redhat dot com
2022-04-21 9:33 ` mcermak at redhat dot com
2022-04-21 12:33 ` mcermak at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: wcohen at redhat dot com @ 2022-04-20 18:17 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
--- Comment #5 from William Cohen <wcohen at redhat dot com> ---
The mlockall allows the access to the string in the readonly section.
[wcohen@fedora x86_ro_string]$ cat acct6.c
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
char *a="foobar";
char buffer[32];
int main()
{
mlockall(MCL_CURRENT);
acct(a);
strcpy (&buffer[0], a);
acct(&buffer[0]);
acct((char *)-1);
return 0;
}
[wcohen@fedora x86_ro_string]$ gcc -o acct6 -O2 acct6.c
[wcohen@fedora x86_ro_string]$ sudo stap -c ./acct6 sys_acct.stp
kprobe.function("__x64_sys_acct")?("foobar")
kprobe.function("__x64_sys_acct")?("foobar")
kprobe.function("__x64_sys_acct")?(0xffffffffffffffff)
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
` (5 preceding siblings ...)
2022-04-20 18:17 ` wcohen at redhat dot com
@ 2022-04-21 9:33 ` mcermak at redhat dot com
2022-04-21 12:33 ` mcermak at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: mcermak at redhat dot com @ 2022-04-21 9:33 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
--- Comment #6 from Martin Cermak <mcermak at redhat dot com> ---
Created attachment 14075
--> https://sourceware.org/bugzilla/attachment.cgi?id=14075&action=edit
proposed patch
Thank you for looking into this. The attached patch based on your findings
already significantly improves the situation for the affected testcases.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug runtime/29076] user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines
2022-04-20 14:45 [Bug runtime/29076] New: user_string_quoted() doesn't properly generate strings in .rodata on x86_64 machines wcohen at redhat dot com
` (6 preceding siblings ...)
2022-04-21 9:33 ` mcermak at redhat dot com
@ 2022-04-21 12:33 ` mcermak at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: mcermak at redhat dot com @ 2022-04-21 12:33 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=29076
Martin Cermak <mcermak at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Martin Cermak <mcermak at redhat dot com> ---
Fixed in commit 6577f2237368a39a5fb289f7deef0cf73b7d290b
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread