Bug 358030

Summary: support direct socket calls on x86 32bit (new in linux 4.3)
Product: [Developer tools] valgrind Reporter: Ron <ronald.wahl>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: grave CC: mark, philippe.waroquiers
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch that adds the direct socket syscall definitions for x86

Description Ron 2016-01-15 15:28:32 UTC
Linux kernel 4.3 adds direct socket syscalls instead of using the socketcall syscall. Valgrind cannot decode these yet for this arch and so the program running via valgrind does not work correctly. I created a patch that updates the syscall numbers and add the socket syscall wrappers. It is only roughly tested...

Reproducible: Always

Steps to Reproduce:
1. On x86 32bit call valgrind on an application that has been build against the new syscall interface
2.
3.

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

Expected Results:  
no such message listed above
Comment 1 Ron 2016-01-15 15:30:20 UTC
Created attachment 96657 [details]
Patch that adds the direct socket syscall definitions for x86
Comment 2 Philippe Waroquiers 2016-01-15 22:26:34 UTC
(In reply to Ron from comment #1)
> Created attachment 96657 [details]
> Patch that adds the direct socket syscall definitions for x86
Thanks for the patch, which seems reasonable (but quick reading only :).
Have you run the regression tests with your patch ?
The testsuite has a bunch of socket related tests, so if there is a lot of failures
without your patch, and a lot less failures with your patch, then that will help to
see the patch is correct/needed/....
Maybe also  memcheck/tests/x86-linux/scalar.c should/could be modified ?
Comment 3 Ron 2016-01-18 10:03:03 UTC
No, I havn't run the testsuite. I just checked if I can run programs via valgrind that use various socket related syscalls.

I have no regular 32bit linux here anymore and the system were I need it is a embedded system with uClibc, busybox, no perl. I fear the test suite requires modifications to do so and at the moment my time is limited...
Comment 4 Mark Wielaard 2016-01-18 21:48:27 UTC
To test against glibc I think you will need a very recent patch to enable them:
https://sourceware.org/ml/libc-alpha/2015-12/msg00156.html
and then a glibc with that patch build against the linux 4.3+ kernel header.
Comment 5 Mark Wielaard 2016-01-20 22:31:25 UTC
It probably won't trigger soon with glibc since it only uses the direct calls if the minimum supported kernel version is 4.3 or higher. But if you do configure glibc with  --enable-kernel against the latest kernel headers then it does indeed use the direct calls and the test programs using socket calls do fail with current valgrind (and pass with the patch applied).

Pushed patch as valgrind svn r15764

Thanks