ret_from_syscall source code and when it is called

316 views Asked by At

In the below call trace we see function called ret_from_syscall. Which function is this ? When it will called during system call ? Where is the corresponding code for this ?

May  7 16:40:34.322086 warn TCU-0 kernel: [cf83ddc0] [00009751] 0x9751 (unreliable)
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83ddd0] [c00469ac] do_syslog+0x198/0x424
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83de30] [c0149574] kmsg_read+0x58/0x68
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83de40] [c013f4c8] proc_reg_read+0x90/0xa8
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83de70] [c00f4cb0] do_loop_readv_writev+0x48/0x84
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83dea0] [c00f5870] do_readv_writev+0xcc/0x19c
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83df10] [c00f5c54] sys_readv+0x50/0xfc
May  7 16:40:34.322086 warn TCU-0 kernel: [cf83df40] [c00100d8] ret_from_syscall+0x0/0x4
May  7 16:40:34.322086 warn TCU-0 kernel: --- Exception: c01 at 0xfcad5a8
1

There are 1 answers

0
Gil Hamilton On BEST ANSWER

The ret_from_syscall symbol will be in architecture-specific assembly code (it does not exist for all architectures). I would look in arch/XXX/kernel/entry.S.

It's not actually a function. It is part of the assembly code that handles the transition from user-space into kernel-space for a system call. It's simply a label to which other parts of the (assembly) code can branch when control is to be returned to user-space. It almost certainly corresponds to an address immediately after a call(*) instruction that invokes the system call-specific routine in the normal system call execution path. In this case, the system call invoked was readv(2).

Typically, execution would reach this symbol not through a direct branch instruction, but as a result of a return-from-subroutine instruction. The exception would be if an illegal system call number were specified or something like that.

(* The call instruction has different mnemonic and behavioral details depending on the architecture. It might be jump-to-subroutine or branch-and-link or something similar.)