linux/arch/mips
Eric Paris d7e7528bcd Audit: push audit success and retcode into arch ptrace.h
The audit system previously expected arches calling to audit_syscall_exit to
supply as arguments if the syscall was a success and what the return code was.
Audit also provides a helper AUDITSC_RESULT which was supposed to simplify things
by converting from negative retcodes to an audit internal magic value stating
success or failure.  This helper was wrong and could indicate that a valid
pointer returned to userspace was a failed syscall.  The fix is to fix the
layering foolishness.  We now pass audit_syscall_exit a struct pt_reg and it
in turns calls back into arch code to collect the return value and to
determine if the syscall was a success or failure.  We also define a generic
is_syscall_success() macro which determines success/failure based on if the
value is < -MAX_ERRNO.  This works for arches like x86 which do not use a
separate mechanism to indicate syscall failure.

We make both the is_syscall_success() and regs_return_value() static inlines
instead of macros.  The reason is because the audit function must take a void*
for the regs.  (uml calls theirs struct uml_pt_regs instead of just struct
pt_regs so audit_syscall_exit can't take a struct pt_regs).  Since the audit
function takes a void* we need to use static inlines to cast it back to the
arch correct structure to dereference it.

The other major change is that on some arches, like ia64, MIPS and ppc, we
change regs_return_value() to give us the negative value on syscall failure.
THE only other user of this macro, kretprobe_example.c, won't notice and it
makes the value signed consistently for the audit functions across all archs.

In arch/sh/kernel/ptrace_64.c I see that we were using regs[9] in the old
audit code as the return value.  But the ptrace_64.h code defined the macro
regs_return_value() as regs[3].  I have no idea which one is correct, but this
patch now uses the regs_return_value() function, so it now uses regs[3].

For powerpc we previously used regs->result but now use the
regs_return_value() function which uses regs->gprs[3].  regs->gprs[3] is
always positive so the regs_return_value(), much like ia64 makes it negative
before calling the audit code when appropriate.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: H. Peter Anvin <hpa@zytor.com> [for x86 portion]
Acked-by: Tony Luck <tony.luck@intel.com> [for ia64]
Acked-by: Richard Weinberger <richard@nod.at> [for uml]
Acked-by: David S. Miller <davem@davemloft.net> [for sparc]
Acked-by: Ralf Baechle <ralf@linux-mips.org> [for mips]
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [for ppc]
2012-01-17 16:16:56 -05:00
..
alchemy Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2011-11-03 13:28:14 -07:00
ar7 MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
ath79 USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs 2011-04-13 16:58:19 -07:00
bcm47xx mips: add export.h to files using EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:30:57 -04:00
bcm63xx MIPS: BCM63XX: use the new bcm63xxpart parser 2012-01-09 18:16:25 +00:00
boot MIPS: Alchemy: Rewrite UART setup and constants. 2011-05-19 09:55:45 +01:00
cavium-octeon MIPS: Octeon: Fix compile error in arch/mips/cavium-octeon/flash_setup.c 2011-11-10 17:59:45 +00:00
cobalt MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
configs rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
dec MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
emma MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check 2011-11-08 12:35:29 +00:00
fw Merge branch 'master' into for-next 2011-04-26 10:22:59 +02:00
include/asm Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
jazz i8253: Create linux/i8253.h and use it in all 8253 related files 2011-06-09 15:01:37 +02:00
jz4740 MIPS: JZ4740: GPIO: Check correct IRQ in demux handler 2011-10-24 23:34:25 +01:00
kernel Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
lantiq MIPS: lantiq: use export.h in favour of module.h 2011-11-14 13:59:24 +00:00
lasat MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
lib mips: switch to GENERIC_PCI_IOMAP 2011-11-28 21:13:13 +02:00
loongson mips: fix implicit smp.h usage in various files. 2011-10-31 19:30:55 -04:00
math-emu perf: Remove the nmi parameter from the swevent and overflow interface 2011-07-01 11:06:35 +02:00
mipssim atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
mm MIPS: Remove __init from add_wired_entry() 2011-10-24 23:34:23 +01:00
mti-malta MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
netlogic MIPS: XLR, XLS: Add comment for smp setup 2011-10-24 23:34:25 +01:00
oprofile MIPS: oprofile: Add callgraph support 2011-06-15 14:35:34 +02:00
pci mips/PCI: convert to pci_scan_root_bus() for correct root bus resources 2012-01-06 12:11:02 -08:00
pmc-sierra MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check 2011-11-08 12:35:29 +00:00
pnx833x Fix common misspellings 2011-03-31 11:26:23 -03:00
pnx8550 MIPS: PNX8550: Fix section mismatch 2011-10-20 15:00:18 +01:00
power MIPS: Hibernation: Fixes for PAGE_SIZE >= 64kb 2011-05-10 18:15:26 +01:00
powertv Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
rb532 mips: add export.h to files using EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:30:57 -04:00
sgi-ip22 MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
sgi-ip27 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-01-08 13:21:22 -08:00
sgi-ip32
sibyte MIPS: Sibyte: drop select of SIBYTE_CFE 2011-11-13 21:27:34 +01:00
sni MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD 2011-09-21 17:52:15 +02:00
txx9 driver-core: remove sysdev.h usage. 2011-12-21 16:26:03 -08:00
vr41xx mips: fix implicit smp.h usage in various files. 2011-10-31 19:30:55 -04:00
wrppmc
Kbuild
Kbuild.platforms MIPS: XLR, XLS: Move makefile bits to were they belong. 2011-07-20 23:12:11 +01:00
Kconfig lib: use generic pci_iomap on all architectures 2012-01-10 18:04:27 -08:00
Kconfig.debug lib: consolidate DEBUG_STACK_USAGE option 2011-05-25 08:39:54 -07:00
Makefile kbuild: Fix missing system calls check on mips. 2011-11-09 14:37:44 +01:00