linux-hardened/arch/um/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
..
skas um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
asm-offsets.c
config.c.in uml: remove useless comments 2009-04-01 08:59:17 -07:00
dyn.lds.S uml: fix CONFIG_STATIC_LINK=y build failure with newer glibc 2010-10-26 16:52:12 -07:00
early_printk.c um: add earlyprintk support 2011-05-25 08:39:41 -07:00
exec.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
exitcode.c uml: convert to seq_file/proc_fops 2009-12-15 08:53:25 -08:00
gmon_syms.c um: fix gcov build breakage 2011-11-02 14:15:26 +01:00
gprof_syms.c uml: style fixes in arch/um/kernel 2008-02-05 09:44:30 -08:00
init_task.c Rename .data.init_irqstack to .data..init_irqstack. 2010-03-03 11:25:59 +01:00
initrd.c um: make load_initrd() static, kill shared/initrd.h 2011-11-02 14:15:06 +01:00
internal.h uml: fix compile warning 2010-09-22 17:22:39 -07:00
irq.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
ksyms.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
Makefile um: kill dead code around uaccess 2011-11-02 14:14:52 +01:00
mem.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
physmem.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
process.c nohz: Remove tick_nohz_idle_enter_norcu() / tick_nohz_idle_exit_norcu() 2011-12-11 10:31:57 -08:00
ptrace.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
reboot.c um: remove dead code 2011-07-25 20:57:13 -07:00
sigio.c uml: style fixes in arch/um/kernel 2008-02-05 09:44:30 -08:00
signal.c um: kill includes of sysdep/sigcontext.h from stuff built with kernel headers 2011-11-02 14:14:54 +01:00
smp.c mm: now that all old mmu_gather code is gone, remove the storage 2011-05-25 08:39:16 -07:00
syscall.c uml: fix compile warning 2010-09-22 17:22:39 -07:00
sysrq.c Remove multiple KERN_ prefixes from printk formats 2009-07-08 10:30:03 -07:00
time.c clocksource: um: Convert to clocksource_register_hz/khz 2011-11-21 19:01:03 -08:00
tlb.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
trap.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
um_arch.c um: distribute exports to where exported stuff is defined 2011-11-02 14:15:36 +01:00
umid.c uml: style fixes in arch/um/kernel 2008-02-05 09:44:30 -08:00
uml.lds.S uml: fix CONFIG_STATIC_LINK=y build failure with newer glibc 2010-10-26 16:52:12 -07:00
vmlinux.lds.S arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0 2009-09-20 12:28:22 +02:00