Closed vt-alt closed 3 weeks ago
I'm not totally familiar with arch, how does one install verify-elf?
verify-elf is integrated in our build system and is not independent tool. If you want to reproduce results, basically it reduces to readelf --wide --symbols ./usr/bin/stress-ng | grep -w -f verify-elf-non-lfs-funcs.list
:
builder@i586:~/tmp/stress-ng-buildroot$ readelf --wide --symbols ./usr/bin/stress-ng| grep -w -f /usr/lib/rpm/verify-elf-non-lfs-funcs.list
546: 00000000 0 FUNC GLOBAL DEFAULT UND __ppoll_chk@GLIBC_2.16 (35)
The verify-elf-non-lfs-funcs.list
is generated with this formula (on 32-bit host):
readelf --wide --symbols /lib/libc.so.6 /lib/libz.so.1 /lib/librt.so.1 |
sed -n 's/^[[:space:]]*[0-9]\+:[[:space:]]\+[0-9a-f]\+[[:space:]]\+[0-9]\+[[:space:]]\+FUNC[[:space:]]\+[^[:space:]]\+[[:space:]]\+DEFAULT[[:space:]]\+[0-9]\+[[:space:]]\+\([^@[:space:]]\+\)@\?.*/\1/p' |
sort -u > all-funcs
sed -r -n 's/^(.+)64(_.*|$)/\1\2/p' all-funcs |
sort -u |
grep -E -v '^(wcs|str)' |
comm -12 - all-funcs |
LC_ALL=C sort -u \
> verify-elf-non-lfs-funcs.list
Does this change help fix the issue?
diff --git a/stress-ng.h b/stress-ng.h index ae35ddde5..3c5f20e79 100644 --- a/stress-ng.h +++ b/stress-ng.h @@ -26,6 +26,10 @@ #define _GNU_SOURCE #endif
+#if !defined(USE_TIME_BITS64) +#define USE_TIME_BITS64 +#endif +
Yes this helped. Thanks. Strangely, I see your reply on email but not on github web.
I've removed that fix as it breaks other 64 bit builds. I have an improved fix that I'm just testing now on several arches
I've just pushed the following commit that I think should resolve this issue:
commit 9b3e9418715b013889e487ac40d14b85a2def7c4 (HEAD -> master, origin/master, origin/HEAD) Author: Colin Ian King colin.i.king@gmail.com Date: Mon Nov 4 14:29:09 2024 +0000
core-shim: add shim to ppoll() and workaround fortification issues
Thanks. But, with 9b3e9418715b013889e487ac40d14b85a2def7c4 applied it still produces the error on my setup.
I see another commit appeared, and with current origin/master
(tip 15484dc9c24be214059b5bfecccb6f26bd79833c) the problem is still remains.
Can you try this change:
diff --git a/core-shim.c b/core-shim.c
index a7813474a..f6d0ea959 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -2843,7 +2843,7 @@ int shim_ppoll(
#undef STRESS__FORTIFY_SOURCE
#define STRESS__FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
-#define _FORTIFY_SOURCE 2
+//#define _FORTIFY_SOURCE 2
#endif
return ppoll(fds, nfds, tmo_p, sigmask);
When applied over origin/master
it still causes an error (non-LFS functions: __ppoll_chk
).
I may apply a hammer to fix this.. can you provide me the output from:
gcc -E -dM -xc /dev/null
Can you try this change:
diff --git a/core-shim.c b/core-shim.c
index a7813474a..8da738ffb 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -19,6 +19,11 @@
*/
#define STRESS_CORE_SHIM
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE == 3
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 2
+#endif
+
Can you try this change:
After this applied to current master
the problem disappeared.
I may apply a hammer to fix this.. can you provide me the output from:
gcc -E -dM -xc /dev/null
gcc-O.txt there is the above command with -O
added.
I think the latest commit fixes this issue, I've pushed a fix. Please test and let me know. Thank you :-)
Tested master
and it fixes the problem. Thanks!
V0.18.05 and V0.18.06 have issue#350 reappeared on 32-bit x86.
verify-elf
is a tool we have that checks ELF binaries in the built rpm packages for problems, and there it detects a single non-LFS (large file support) syscall in 32-binary.Proper LFS syscall would be
__ppoll64_chk
.Our gcc have
-D_FORTIFY_SOURCE=3
added by default into-O
(I think Fedora have something like this too), but your code seems to expect fortify level 2. If I add to CFLAGS-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
it then compiles without aforementioned error.