* [Bug runtime/24935] New: Reading userland static data always leads to read faults on Fedora 29 x86_64
@ 2019-08-24 1:13 agentzh at gmail dot com
2024-04-10 21:25 ` [Bug runtime/24935] " wcohen at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: agentzh at gmail dot com @ 2019-08-24 1:13 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=24935
Bug ID: 24935
Summary: Reading userland static data always leads to read
faults on Fedora 29 x86_64
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: runtime
Assignee: systemtap at sourceware dot org
Reporter: agentzh at gmail dot com
Target Milestone: ---
I've noted that reading userland C static data always fails with read faults
(-14) on Fedora 29 x86_64. Below is a minimal example that can demonstrate this
issue:
File test.c:
static const char *s = "hi";
int main(void) {
return 0;
}
File test.stp:
probe process.function("main") {
printf("s = %s\n", user_string(@var("s")));
}
And then compile the test.c C program:
gcc -g test.c
And then run the test.stp script:
$ stap test.stp -c './a.out'
ERROR: user string copy fault -14 at 00000000a25ef291 [man error::fault]
near identifier 'user_string_n' at
/opt/stap/share/systemtap/tapset/uconversions.stp:114:10
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /opt/stap/bin/staprun exited with status: 1
Pass 5: run failed. [man error::pass5]
I'm using the latest stap master branch (commit 8ffab23ff4):
$ /opt/stap/bin/stap -V
Systemtap translator/driver (version 4.2/0.176, commit
release-4.1-72-g8ffab23ff4a1)
Copyright (C) 2005-2019 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.18 ... 5.1-rc2
enabled features: AVAHI BPF PYTHON2 LIBSQLITE3 LIBXML2 NLS NSS READLINE
The system is Fedora 29:
$ cat /etc/redhat-release
Fedora release 29 (Twenty Nine)
More info:
$ gcc --version
gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux glass 5.1.20-200.fc29.x86_64 #1 SMP Fri Jul 26 15:15:46 UTC 2019
x86_64 x86_64 x86_64 GNU/Linux
The same test example works flawlessly on CentOS 7:
$ stap -c './a.out' test.stp
s = hi
Using gcc options -fpic -pie to compile the test.c program makes no difference:
ERROR: user string copy fault -14 at 000000004e89a066 [man error::fault]
near identifier 'user_string_n' at
/opt/stap/share/systemtap/tapset/uconversions.stp:114:10
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /opt/stap/bin/staprun exited with status: 1
Pass 5: run failed. [man error::pass5]
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug runtime/24935] Reading userland static data always leads to read faults on Fedora 29 x86_64
2019-08-24 1:13 [Bug runtime/24935] New: Reading userland static data always leads to read faults on Fedora 29 x86_64 agentzh at gmail dot com
@ 2024-04-10 21:25 ` wcohen at redhat dot com
0 siblings, 0 replies; 2+ messages in thread
From: wcohen at redhat dot com @ 2024-04-10 21:25 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=24935
William Cohen <wcohen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |wcohen at redhat dot com
Resolution|--- |NOTABUG
--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
One could have the probe fire after the static string has been accessed by
test.c, for example in the process("function").return for a function that
accesses s. However, in this test.c example for this PR nothing is going to
ever going to cause a page fault to pull in that static page that s points at.
Systemtap can only access pages that are already mapped in. SystemTap can't
trigger a pagefault to map in a page that is not currently mapped in. A similar
situation was observed on a number of the testsuite/systemtap.syscall tests
where a string was stored on a page that was not mapped in on syscall entry and
the syscall would page fault the string in. The work around in the syscall
tests was to use mlockall(MCL_CURRENT) to ensure that the string in .rodata
section was mapped in. One example fix of this is git commit
e67e4b19fd73953fbc8a23c91ae22f9d35a7c817:
Author: William Cohen <wcohen@redhat.com> 2023-11-15 17:01:14
Committer: William Cohen <wcohen@redhat.com> 2023-11-15 17:01:14
Parent: 114de05acfdab36295c9c6beee9715e986810d11 (PR29076: Additional syscall
test fixes for .rodata on x86_64)
Child: 130af146398ca5788be92d258eabe1cee662037f (Tweak
testsuite/semok/target_addr.stp to work with linux 5.14 and newer.)
Branches: master, remotes/origin/master, remotes/origin/mcermak-pr30321,
wcohen/nfs
Follows: release-5.0a
Precedes:
PR29076: syscall test fixes for .rodata on x86_64 for pwritev.c and sysfs.c
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-10 21:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 1:13 [Bug runtime/24935] New: Reading userland static data always leads to read faults on Fedora 29 x86_64 agentzh at gmail dot com
2024-04-10 21:25 ` [Bug runtime/24935] " 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).