Skip to contentSkip to conversation

proc: test /proc/self/syscall

PATCH In review Alexey Dobriyan 2 participants 4 messages Feb 26, 2018 – May 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 proc: test /proc/self/syscall

Read from /proc/self/syscall should yield read system call and correct args in the output as current is reading /proc/self/syscall.

---

 tools/testing/selftests/proc/.gitignore          |    3 +
 tools/testing/selftests/proc/Makefile            |    1 
 tools/testing/selftests/proc/proc-self-syscall.c |   45 +++++++++++++++++++++++
 3 files changed, 48 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/.gitignore +2 -1
@@ -1 +1,2 @@
-/proc-self-wchan
+/proc-self-mem
+/proc-self-syscall
tools/testing/selftests/proc/Makefile +1 -0
@@ -1,6 +1,7 @@
 CFLAGS += -Wall -O2
 
 TEST_GEN_PROGS :=
+TEST_GEN_PROGS += proc-self-syscall
 TEST_GEN_PROGS += proc-self-wchan
 
 include ../lib.mk

new file mode 100644

tools/testing/selftests/proc/proc-self-syscall.c new file +45 -0

45 lines not on this page · raw message

#1 lore raw

Hi Alexey,

Quoted 2 lines · Alexey Dobriyan

Read from /proc/self/syscall should yield read system call and correct args in the output as current is reading /proc/self/syscall.

Is this test expected to work on arm32 bit architecture ? I have tested on arm32 devices and it returns 1 and reported as FAIL.

Strace output:
<snip>
munmap(0xb6f4a000, 13514) = 0
open("/proc/self/syscall", O_RDONLY) = 3
read(3, "3 0x3 0xbeacfbe0 0x40 0x3 0xbeac"..., 64) = 64
exit_group(0) = ?
+++ exited with 0 +++

Ref:
selftests: proc-self-syscall failed on arm32
https://bugs.linaro.org/show_bug.cgi?id=3783

#2 lore raw
Quoted 6 lines · Naresh Kamboju

Hi Alexey,

Quoted 2 lines · Alexey Dobriyan

Read from /proc/self/syscall should yield read system call and correct args in the output as current is reading /proc/self/syscall.

Quoted 8 lines

Is this test expected to work on arm32 bit architecture ? I have tested on arm32 devices and it returns 1 and reported as FAIL.

Strace output:
<snip>
munmap(0xb6f4a000, 13514) = 0
open("/proc/self/syscall", O_RDONLY) = 3
read(3, "3 0x3 0xbeacfbe0 0x40 0x3 0xbeac"..., 64) = 64

Yes! Obviously, it was tested on x86_64 only.

arch/arm/tools/syscall.tbl shows read is #3
and pointer looks 32-bit, so what's wrong?

#3 lore raw
Quoted 16 lines · Alexey Dobriyan
Quoted 6 lines · Naresh Kamboju

Hi Alexey,

Quoted 2 lines · Alexey Dobriyan

Read from /proc/self/syscall should yield read system call and correct args in the output as current is reading /proc/self/syscall.

Quoted 8 lines

Is this test expected to work on arm32 bit architecture ? I have tested on arm32 devices and it returns 1 and reported as FAIL.

Strace output:
<snip>
munmap(0xb6f4a000, 13514) = 0
open("/proc/self/syscall", O_RDONLY) = 3
read(3, "3 0x3 0xbeacfbe0 0x40 0x3 0xbeac"..., 64) = 64

Quoted 4 lines

Yes! Obviously, it was tested on x86_64 only.

arch/arm/tools/syscall.tbl shows read is #3
and pointer looks 32-bit, so what's wrong?

Please ignore the strace output because test return 0 for strace process.

Here is the modified test case with more prints, which shows test case failed due to third condition is true.
strncmp() return 3.
Is strncmp() implementation different on 32 and 64 bit architecture in glibc ?

Test case and output:
https://pastebin.com/grL2TUzs

- Naresh