2.4 force_successful_syscall()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Bjorn Helgaas
Here's a 2.4 backport of this change to 2.5:
http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.htmlAlpha, ppc, and sparc64 define
force_successful_syscall_return()in 2.5, but since it's not obvious to me how to do it correctly in 2.4, I left them unchanged.
Whats the reasoning behing this patch?
Quoted 5 lines · Marcelo Tosatti
Quoted 2 lines · Bjorn Helgaas
Here's a 2.4 backport of this change to 2.5:
Quoted 7 lines
Quoted 5 lines
http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.htmlAlpha, ppc, and sparc64 define
force_successful_syscall_return()in 2.5, but since it's not obvious to me how to do it correctly in 2.4, I left them unchanged.Whats the reasoning behing this patch?
Basically we don't want a large unsigned return value to be misinterpreted as a syscall failure because it looks like a small negative number.
Quoted 1 line
From David's description of the 2.5 patch (the link above has
the explanation):
Many architectures (alpha, ia64, ppc, ppc64, sparc, and sparc64 at least) use a syscall convention which provides for a return value and a separate error flag. On those architectures, it can be beneficial if the kernel provides a mechanism to signal that a syscall call has completed successfully, even when the returned value is potentially a (small) negative number. The patch below provides a hook for such a mechanism via a macro called force_successful_syscall_return(). On x86, this would be simply a no-op (because on x86, user-level has to be hacked to handle such cases).
Quoted 5 lines · Marcelo Tosatti
Quoted 3 lines · Bjorn Helgaas
Here's a 2.4 backport of this change to 2.5:
Quoted 8 lines
http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html
Quoted 2 lines
Alpha, ppc, and sparc64 define
force_successful_syscall_return()in2.5,
Quoted 2 lines
but since it's not obvious to me how to do it correctly in 2.4, I left them unchanged.
Whats the reasoning behing this patch?
IIRC those changes were added to 2.5 by David. Architecture like Ia64 and Alpha support error return via a different register set ( $19 for Alpha ). But syscalls like ptrace can have negative return value for successful returns. So in that particular case $19 is forced to be zero to indicate it is a successful return. IIUC force_successful_syscall_return is a wrapper around doing that. On alpha actually r0 in the stack (regs.r0 ) is made zero which is read in entry.S and put in $19.
-aneesh
Quoted 17 lines · Aneesh
Quoted 6 lines · Marcelo Tosatti
Quoted 3 lines · Bjorn Helgaas
Here's a 2.4 backport of this change to 2.5:
http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html
Quoted 4 lines
Quoted 2 lines
Alpha, ppc, and sparc64 define
force_successful_syscall_return()in2.5,
Quoted 1 line
but since it's not obvious to me how to do it correctly in 2.4, I
left
Quoted 3 lines
Quoted 1 line
them unchanged.
Whats the reasoning behing this patch?
Quoted 8 lines
IIRC those changes were added to 2.5 by David. Architecture like Ia64 and Alpha support error return via a different register set ( $19 for Alpha ). But syscalls like ptrace can have negative return value for successful returns. So in that particular case $19 is forced to be zero to indicate it is a successful return. IIUC
force_successful_syscall_returnis a wrapper around doing that. On alpha actually r0 in the stack (regs.r0 ) is made zero which is read inentry.Sand put in $19.
For IA64 I guess it is r10 and regs.r8. May be other can correct me if i am wrong.
-aneesh