[PATCH v2 02/16] sparc/compat: Provide an accurate in_compat_syscall implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On sparc64 compat-enabled kernels, any task can make 32-bit and
64-bit syscalls.  is_compat_task returns true in 32-bit tasks, which
does not necessarily imply that the current syscall is 32-bit.

Provide an in_compat_syscall implementation that checks whether the
current syscall is compat.

As far as I know, sparc is the only architecture on which
is_compat_task checks the compat status of the task and on which the
compat status of a syscall can differ from the compat status of the
task.  On x86, is_compat_task checks the syscall type, not the task
type.

Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
---
 arch/sparc/include/asm/compat.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index 830502fe62b4..5467404857fc 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -307,4 +307,10 @@ static inline int is_compat_task(void)
 	return test_thread_flag(TIF_32BIT);
 }
 
+static inline bool in_compat_syscall(void)
+{
+	return pt_regs_trap_type(current_pt_regs()) == 0x110;
+}
+#define in_compat_syscall in_compat_syscall
+
 #endif /* _ASM_SPARC64_COMPAT_H */
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux