OpenCloudOS-Kernel/arch/s390/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
..
vdso32 [S390] vdso: disable gcov profiling 2011-05-23 10:24:29 +02:00
vdso64 [S390] vdso: disable gcov profiling 2011-05-23 10:24:29 +02:00
Makefile [S390] topology: get rid of ifdefs 2011-12-27 11:27:10 +01:00
asm-offsets.c [S390] cleanup trap handling 2011-12-27 11:27:12 +01:00
audit.c [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
audit.h [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
base.S [S390] entry[64].S improvements 2011-12-27 11:27:12 +01:00
bitmap.c [S390] move EXPORT_SYMBOLs to definitions 2009-03-26 15:24:11 +01:00
compat_audit.c [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
compat_exec_domain.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
compat_linux.c [S390] ipc: call generic sys_ipc demultiplexer 2011-12-27 11:27:13 +01:00
compat_linux.h Mark arguments to certain syscalls as being const 2010-08-13 16:53:13 -07:00
compat_ptrace.h [S390] ptrace cleanup 2011-01-05 12:47:31 +01:00
compat_signal.c [S390] return address of compat signals 2011-12-27 11:27:14 +01:00
compat_wrapper.S [S390] wire up process_vm syscalls 2011-11-14 11:19:08 +01:00
cpcmd.c [S390] convert cpcmd printks to pr_xxx macros. 2008-12-25 13:39:19 +01:00
crash.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
crash_dump.c [S390] Remove error checking from copy_oldmem_page() 2011-10-30 15:16:47 +01:00
debug.c switch debugfs to umode_t 2012-01-03 22:54:56 -05:00
diag.c [S390] replace diag10() with diag10_range() function 2011-05-10 17:13:43 +02:00
dis.c [S390] disassembler: mark exception causing instructions 2011-12-27 11:27:14 +01:00
early.c [S390] Check for NULL termination in command line setup 2011-12-27 11:25:48 +01:00
ebcdic.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
entry.S [S390] cleanup trap handling 2011-12-27 11:27:12 +01:00
entry.h [S390] cleanup trap handling 2011-12-27 11:27:12 +01:00
entry64.S [S390] cleanup trap handling 2011-12-27 11:27:12 +01:00
ftrace.c [S390] cleanup ftrace backend functions 2011-01-05 12:47:31 +01:00
head.S [S390] entry[64].S improvements 2011-12-27 11:27:12 +01:00
head31.S [S390] smp: external call vs. emergency signal 2011-10-30 15:16:44 +01:00
head64.S [S390] smp: external call vs. emergency signal 2011-10-30 15:16:44 +01:00
head_kdump.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
init_task.c Use new __init_task_data macro in arch init_task.c files. 2009-09-21 06:27:08 +02:00
ipl.c [S390] sparse: fix sparse warnings about missing prototypes 2011-10-30 15:16:46 +01:00
irq.c [S390] irqstats: split IPI interrupt accounting 2011-10-30 15:16:47 +01:00
jump_label.c s390/jump-label: add arch_jump_label_transform_static() 2011-10-25 11:54:37 -07:00
kprobes.c [S390] sparse: fix sparse static warnings 2011-10-30 15:16:46 +01:00
machine_kexec.c [S390] Add VMCOREINFO_SYMBOL(high_memory) to vmcoreinfo 2011-12-27 11:27:13 +01:00
mcount.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
mcount64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
mem_detect.c [S390] Rework create_mem_hole() function 2011-12-27 11:27:09 +01:00
module.c modules: make arch's use default loader hooks 2011-07-24 22:06:04 +09:30
nmi.c [S390] irq: have detailed statistics for interrupt types 2011-01-05 12:47:25 +01:00
process.c nohz: Remove tick_nohz_idle_enter_norcu() / tick_nohz_idle_exit_norcu() 2011-12-11 10:31:57 -08:00
processor.c [S390] avoid warning in show_cpuinfo 2011-10-30 15:16:15 +01:00
ptrace.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
reipl.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
reipl64.S [S390] entry[64].S improvements 2011-12-27 11:27:12 +01:00
relocate_kernel.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
relocate_kernel64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
s390_ksyms.c [S390] move sie code to entry.S 2011-07-24 10:48:21 +02:00
sclp.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
setup.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2012-01-09 08:11:13 -08:00
signal.c [S390] cleanup trap handling 2011-12-27 11:27:12 +01:00
smp.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2012-01-09 08:11:13 -08:00
stacktrace.c [S390] Fix stacktrace compile bug. 2008-07-17 17:22:09 +02:00
suspend.c [S390] sparse: fix sparse warnings about missing prototypes 2011-10-30 15:16:46 +01:00
switch_cpu.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
switch_cpu64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
swsusp_asm64.S PM / Hibernate: Include storage keys in hibernation image on s390 2011-10-16 23:27:46 +02:00
sys_s390.c [S390] ipc: call generic sys_ipc demultiplexer 2011-12-27 11:27:13 +01:00
syscalls.S [S390] wire up process_vm syscalls 2011-11-14 11:19:08 +01:00
sysinfo.c [S390] sparse: fix sparse warnings in math-emu 2011-10-30 15:16:46 +01:00
time.c s390: time - convert sysdev_class to a regular subsystem 2011-12-21 15:09:50 -08:00
topology.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2012-01-09 08:11:13 -08:00
traps.c [S390] Enable exception traces by default 2011-12-27 11:27:14 +01:00
vdso.c mm: arch: rename in_gate_area_no_task to in_gate_area_no_mm 2011-03-23 16:36:55 -04:00
vmlinux.lds.S [S390] incorrect note program header 2011-11-14 11:19:08 +01:00
vtime.c [S390] sparse: fix sparse static warnings 2011-10-30 15:16:46 +01:00