Bug 397012 - glibc ld.so uses arch_prctl on i386
Summary: glibc ld.so uses arch_prctl on i386
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.14 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-31 13:19 UTC by Mark Wielaard
Modified: 2018-08-16 13:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2018-07-31 13:19:09 UTC
arch_prctl used to be amd64 only. But since linux 4.12 it is also implemented or i386. And since glibc 2.28 (not yet released) it will be used to see if the cpu/kernel provides CET support.

See also https://bugs.kde.org/show_bug.cgi?id=396887

To prevent seeing:

WARNING: unhandled x86-linux syscall: 384
You may be able to write your own handler.
Read the file README_MISSING_SYSCALL_OR_IOCTL.
Nevertheless we consider this a bug.  Please report
it at http://valgrind.org/support/bug_reports.html.

on every program run under valgrind I just made it ENOSYS on Fedora:

diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index bec145a..11bb13d 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1604,7 +1604,10 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_sendmsg,           sys_sendmsg),          // 370
    LINXY(__NR_recvfrom,          sys_recvfrom),         // 371
    LINXY(__NR_recvmsg,           sys_recvmsg),          // 372
-   LINX_(__NR_shutdown,          sys_shutdown)          // 373
+   LINX_(__NR_shutdown,          sys_shutdown),         // 373
+
+   /* Explicitly not supported on i386 yet. */
+   GENX_(__NR_arch_prctl,        sys_ni_syscall)        // 384
 };
 
 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )

This is fine for glibc/ld.so usage since any failure indicates no CET support.
Comment 1 Mark Wielaard 2018-08-06 13:01:04 UTC
commit 2eb2df759f51b15702934dee108f4c20c3db5fef
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Jul 31 15:32:43 2018 +0200

    Bug 397012 - glibc ld.so uses arch_prctl on i386.
    
    arch_prctl used to be amd64 only. But since linux 4.12 it is also
    implemented for i386. And since glibc 2.28 ld.so will use it to see
    if the cpu/kernel provides CET support.
    
    To prevent seeing:
    
    WARNING: unhandled x86-linux syscall: 384
    You may be able to write your own handler.
    Read the file README_MISSING_SYSCALL_OR_IOCTL.
    Nevertheless we consider this a bug.  Please report
    it at http://valgrind.org/support/bug_reports.html.
    
    on every program run under valgrind just make it explicitly
    not implemented (ENOSYS). This is fine for the glibc usage.
    It just indicates there is no CET support.
Comment 2 Tom Hughes 2018-08-16 13:42:13 UTC
*** Bug 397521 has been marked as a duplicate of this bug. ***
Comment 3 Tom Hughes 2018-08-16 13:42:53 UTC
*** Bug 397393 has been marked as a duplicate of this bug. ***