linux/arch/sh/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 Merge branch 'driver-core-next' into Linux 3.2 2012-01-06 11:42:52 -08:00
vsyscall mm: arch: rename in_gate_area_no_task to in_gate_area_no_mm 2011-03-23 16:36:55 -04:00
.gitignore
Makefile Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2011-01-06 16:50:35 -08:00
asm-offsets.c
cpufreq.c arch/sh/kernel: Use set_cpus_allowed_ptr 2010-03-29 11:40:37 +09:00
crash_dump.c crash_dump: export is_kdump_kernel to modules, consolidate elfcorehdr_addr, setup_elfcorehdr and saved_max_pfn 2011-03-23 19:47:19 -07:00
debugtraps.S
disassemble.c
dma-nommu.c
dumpstack.c sh: remove warning and warning_symbol from struct stacktrace_ops 2011-05-23 14:42:15 +09:00
dwarf.c sh: handle early calls to return_address() when using dwarf unwinder. 2010-05-25 16:16:40 +09:00
entry-common.S
ftrace.c tracing: Unify arch_syscall_addr() implementations 2010-02-17 13:07:21 +01:00
head_32.S sh: boot kernel with SR.BL set 2010-09-30 09:43:32 +09:00
head_64.S
hw_breakpoint.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2010-05-19 11:36:03 -07:00
idle.c nohz: Remove tick_nohz_idle_enter_norcu() / tick_nohz_idle_exit_norcu() 2011-12-11 10:31:57 -08:00
init_task.c
io.c sh: support for platforms without PIO. 2010-06-02 16:31:42 +09:00
io_trapped.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
iomap.c sh: machvec IO death. 2010-11-01 09:49:04 -04:00
ioport.c sh: machvec IO death. 2010-11-01 09:49:04 -04:00
irq.c sh: use printk_ratelimited instead of printk_ratelimit 2011-06-30 15:10:06 +09:00
irq_32.c Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
irq_64.c sh64: update for IRQ flag handling naming changes. 2010-10-27 15:34:51 +09:00
kdebugfs.c sh: provide generic arch_debugfs_dir. 2010-09-24 04:04:26 +09:00
kgdb.c kgdb,sh: update superh kgdb exception handling 2010-05-20 21:04:20 -05:00
kprobes.c sh: kprobes SMP support. 2010-06-14 17:06:10 +09:00
localtimer.c sh: CPU hotplug support. 2010-04-26 19:08:55 +09:00
machine_kexec.c memblock: s/memblock_analyze()/memblock_allow_resize()/ and update users 2011-12-08 10:22:08 -08:00
machvec.c sh: machvec IO death. 2010-11-01 09:49:04 -04:00
module.c modules: make arch's use default loader hooks 2011-07-24 22:06:04 +09:30
nmi_debug.c
perf_callchain.c sh: remove warning and warning_symbol from struct stacktrace_ops 2011-05-23 14:42:15 +09:00
perf_event.c sh: Add export.h to arch/sh specific files as required. 2011-10-31 19:31:05 -04:00
process.c sh: Fix build alloc_thread_info_node function 2011-03-24 15:19:14 +09:00
process_32.c sh, exec: remove redundant set_fs(USER_DS) 2011-06-14 15:15:58 +09:00
process_64.c Make do_execve() take a const filename pointer 2010-08-17 18:07:43 -07:00
ptrace.c sh: Add kprobe-based event tracer. 2010-06-14 15:16:53 +09:00
ptrace_32.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
ptrace_64.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
reboot.c sh: Provide a global TLB flush for U/I-TLB clear. 2010-07-02 15:44:09 +09:00
relocate_kernel.S
return_address.c sh: handle early calls to return_address() when using dwarf unwinder. 2010-05-25 16:16:40 +09:00
setup.c SuperH: Use HAVE_MEMBLOCK_NODE_MAP 2011-12-08 10:22:08 -08:00
sh_bios.c
sh_ksyms_32.c
sh_ksyms_64.c
signal_32.c
signal_64.c Merge branch 'sh/stable-updates' 2010-02-15 14:49:37 +09:00
smp.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
stacktrace.c sh: remove warning and warning_symbol from struct stacktrace_ops 2011-05-23 14:42:15 +09:00
swsusp.c
sys_sh.c sh: avoid to flush all cache in sys_cacheflush 2010-11-17 17:55:30 +09:00
sys_sh32.c Make do_execve() take a const filename pointer 2010-08-17 18:07:43 -07:00
sys_sh64.c Make do_execve() take a const filename pointer 2010-08-17 18:07:43 -07:00
syscalls_32.S sh: Wire up process_vm syscalls. 2011-11-11 10:58:16 +09:00
syscalls_64.S sh: Wire up process_vm syscalls. 2011-11-11 10:58:16 +09:00
time.c sh: Convert sh to use read/update_persistent_clock 2010-03-05 02:04:38 +09:00
topology.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
traps.c
traps_32.c sh: Add unaligned memory access for PC relative intructions 2011-08-29 15:32:10 +09:00
traps_64.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
unwinder.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
vmlinux.lds.S sh: kexec: Add PHYSICAL_START 2011-10-28 15:03:43 +09:00