]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc: Fix sys_call_table declaration to enable syscall tracing
authorRomeo Cane <romeo.cane.ext@coriant.com>
Thu, 2 Oct 2014 14:41:39 +0000 (15:41 +0100)
committerJiri Slaby <jslaby@suse.cz>
Thu, 9 Apr 2015 12:13:46 +0000 (14:13 +0200)
commit45a252f53c832c715b468c0987be0a27f509cde7
treec60db31dd50433c5da97fc95974aae10a2acd66d
parentc5988181af3b41381c4d20e08ca6852f99f95417
powerpc: Fix sys_call_table declaration to enable syscall tracing

commit 1028ccf560b97adbf272381a61a67e17d44d1054 upstream.

Declaring sys_call_table as a pointer causes the compiler to generate
the wrong lookup code in arch_syscall_addr().

     <arch_syscall_addr>:
        lis     r9,-16384
        rlwinm  r3,r3,2,0,29
  -     lwz     r11,30640(r9)
  -     lwzx    r3,r11,r3
  +     addi    r9,r9,30640
  +     lwzx    r3,r9,r3
        blr

The actual sys_call_table symbol, declared in assembler, is an
array. If we lie about that to the compiler we get the wrong code
generated, as above.

This definition seems only to be used by the syscall tracing code in
kernel/trace/trace_syscalls.c. With this patch I can successfully use
the syscall tracepoints:

  bash-3815  [002] ....   333.239082: sys_write -> 0x2
  bash-3815  [002] ....   333.239087: sys_dup2(oldfd: a, newfd: 1)
  bash-3815  [002] ....   333.239088: sys_dup2 -> 0x1
  bash-3815  [002] ....   333.239092: sys_fcntl(fd: a, cmd: 1, arg: 0)
  bash-3815  [002] ....   333.239093: sys_fcntl -> 0x1
  bash-3815  [002] ....   333.239094: sys_close(fd: a)
  bash-3815  [002] ....   333.239094: sys_close -> 0x0

Signed-off-by: Romeo Cane <romeo.cane.ext@coriant.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/powerpc/include/asm/syscall.h