linux/arch/microblaze/kernel
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
..
cpu microblaze: Add PVR for Microblaze v8.20.a 2011-10-14 12:24:28 +02:00
asm-offsets.c microblaze: Remove "cache" optimized copy_page function 2010-05-06 11:21:58 +02:00
dma.c 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
early_printk.c microblaze: Send CR before LF for early console 2012-01-05 08:34:25 +01:00
entry-nommu.S microblaze: Do not use "la" pseudo instruction - use addik instead 2011-03-09 08:09:54 +01:00
entry.S microblaze: Trivial asm fix 2012-01-05 08:34:28 +01:00
exceptions.c microblaze: Raise SIGFPE/FPE_INTDIV for div by zero 2011-10-14 12:24:31 +02:00
ftrace.c microblaze: Fix ftrace 2011-04-01 09:34:51 +02:00
head.S microblaze: Do not use "la" pseudo instruction - use addik instead 2011-03-09 08:09:54 +01:00
heartbeat.c microblaze: Add support for little-endian Microblaze 2010-10-21 15:51:59 +10:00
hw_exception_handler.S microblaze: Fix unaligned value saving to the stack for system with MMU 2011-07-25 09:07:45 +02:00
init_task.c Use new __init_task_data macro in arch init_task.c files. 2009-09-21 06:27:08 +02:00
intc.c microblaze: Change NO_IRQ to 0 2012-01-05 08:29:13 +01:00
irq.c microblaze: Change NO_IRQ to 0 2012-01-05 08:29:13 +01:00
kgdb.c microblaze: KGDB little endian support 2010-10-21 15:51:58 +10:00
Makefile microblaze: Fix ftrace 2011-04-01 09:34:51 +02:00
mcount.S microblaze: ftrace: Add dynamic function graph tracer 2009-12-14 08:44:54 +01:00
microblaze_ksyms.c microblaze: Add missing export symbols for lib functions 2011-03-09 08:09:59 +01:00
misc.S microblaze: Fix comment for TLB 2010-08-02 10:44:03 +02:00
module.c microblaze: Fix debug message in module 2012-01-05 08:34:27 +01:00
process.c nohz: Remove tick_nohz_idle_enter_norcu() / tick_nohz_idle_exit_norcu() 2011-12-11 10:31:57 -08:00
prom.c memblock: s/memblock_analyze()/memblock_allow_resize()/ and update users 2011-12-08 10:22:08 -08:00
prom_parse.c of/pci: move of_irq_map_pci() into generic code 2011-02-04 11:46:50 -07:00
ptrace.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
reset.c gpio/microblaze: Eliminate duplication of of_get_named_gpio_flags() 2011-12-12 13:40:16 -07:00
selfmod.c microblaze_v8: Selfmodified code 2009-03-27 14:25:15 +01:00
setup.c microblaze: Remove eprintk macro 2012-01-05 08:34:26 +01:00
signal.c microblaze: Fix sparse warnings - signal.c 2011-03-09 08:09:59 +01:00
stacktrace.c microblaze: Add stack unwinder 2010-08-04 10:22:35 +02:00
sys_microblaze.c microblaze: Fix missing microblaze specific syscalls declaration 2011-03-09 08:09:58 +01:00
syscall_table.S microblaze: Wire-up new system calls 2012-01-05 11:16:51 +01:00
timer.c microblaze: Remove eprintk macro 2012-01-05 08:34:26 +01:00
traps.c microblaze: Add stack unwinder 2010-08-04 10:22:35 +02:00
unwind.c microblaze: Fix sparse warning - unwind.c 2011-03-09 08:09:58 +01:00
vmlinux.lds.S microblaze: Remove r0_ram pointer and PTO alignment 2011-03-09 08:09:54 +01:00