linux/arch/sparc/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
..
.gitignore sparc: gitignore a few files 2008-12-04 09:17:15 -08:00
apc.c sparc: Add module.h to files previously implicitly using it. 2011-10-31 19:30:54 -04:00
asm-offsets.c
audit.c sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
auxio_32.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
auxio_64.c sparc64: Fix section mis-match errors. 2011-03-30 17:37:56 -07:00
btext.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
central.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
cherrs.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
chmc.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
compat_audit.c sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
cpu.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
cpumap.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
cpumap.h sparc64: fix and optimize irq distribution 2009-06-16 04:56:28 -07:00
devices.c sparc32: always register a PROM based early console 2011-04-21 15:47:35 -07:00
dma.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
ds.c sparc: Use kmemdup rather than duplicating its implementation 2011-12-04 10:46:56 -08:00
dtlb_miss.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
dtlb_prot.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
ebus.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
entry.h sparc64: Patch sun4v code sequences properly on module load. 2011-11-17 22:44:58 -08:00
entry.S sparc: sun4m SMP: fix wrong shift instruction in IPI handler 2011-07-16 10:45:12 -07:00
etrap_32.S sparc: prepare kernel/ for unification 2008-12-04 09:17:20 -08:00
etrap_64.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
fpu_traps.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
ftrace.c sparc64: Add function graph tracer support. 2010-04-12 22:37:26 -07:00
getsetcc.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
head_32.S sparc32,leon: operate on boot-cpu IRQ controller registers 2011-04-21 16:44:45 -07:00
head_64.S sparc64: Future proof Niagara cpu detection. 2011-09-16 14:21:33 -07:00
helpers.S sparc64: Fix perf_arch_get_caller_regs(). 2010-08-08 22:07:36 -07:00
hvapi.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
hvcalls.S sparc: Set reboot-cmd using reboot data hypervisor call if available. 2011-08-02 21:28:52 -07:00
hvtramp.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
idprom.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
init_task.c Fix common misspellings 2011-03-31 11:26:23 -03:00
iommu_common.h sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
iommu.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
ioport.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2011-07-31 14:30:59 -10:00
irq_32.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
irq_64.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
irq.h sparc32,sun4d: Change IPI IRQ level to prevent collision between IPI and timer interrupt 2011-08-29 09:20:40 -07:00
itlb_miss.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
ivec.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
jump_label.c sparc/jump_label: drop arch_jump_label_text_poke_early() 2011-10-25 11:54:26 -07:00
kernel.h sparc: Set reboot-cmd using reboot data hypervisor call if available. 2011-08-02 21:28:52 -07:00
kgdb_32.c kgdb,sparc: Add in kgdb_arch_set_pc for sparc 2010-05-20 21:04:19 -05:00
kgdb_64.c kgdb,sparc: Add in kgdb_arch_set_pc for sparc 2010-05-20 21:04:19 -05:00
kprobes.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
kstack.h sparc64: Run NMIs on the hardirq stack. 2010-04-14 02:04:29 -07:00
ktlb.S sparc: Access kernel TSB using physical addressing when possible. 2011-08-05 00:53:57 -07:00
ldc.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
led.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
leon_kernel.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
leon_pci_grpci2.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
leon_pci.c sparc32, leon/PCI: convert to pci_scan_root_bus() for correct root bus resources 2012-01-06 12:11:11 -08:00
leon_pmc.c SPARC/LEON: power down instruction different of different LEONs 2011-03-16 18:19:04 -07:00
leon_smp.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
Makefile sparc: Allow handling signals when stack is corrupted. 2011-08-20 17:14:54 -07:00
mdesc.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
misctrap.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
module.c sparc64: Patch sun4v code sequences properly on module load. 2011-11-17 22:44:58 -08:00
muldiv.c sparc: add '32' suffix to reg_window, sigcontext, __siginfo_t 2009-01-02 19:32:59 -08:00
nmi.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
of_device_32.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
of_device_64.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
of_device_common.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
of_device_common.h sparc: move of_device common code to of_device_common 2009-06-16 04:56:49 -07:00
pci_common.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
pci_fire.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
pci_impl.h sparc64: rename virt_irq => irq - II 2011-03-16 18:19:03 -07:00
pci_msi.c sparc: convert old cpumask API into new one 2011-05-16 13:38:07 -07:00
pci_psycho.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
pci_sabre.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
pci_schizo.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
pci_sun4v_asm.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
pci_sun4v.c sparc64: Fix MSIQ HV call ordering in pci_sun4v_msiq_build_irq(). 2011-12-22 13:46:53 -08:00
pci_sun4v.h sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
pci.c sparc/PCI: convert to pci_create_root_bus() 2012-01-06 12:11:11 -08:00
pcic.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
pcr.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
perf_event.c sparc: Detect and handle UltraSPARC-T3 cpu types. 2011-07-27 22:10:10 -07:00
pmc.c sparc: Add module.h to files previously implicitly using it. 2011-10-31 19:30:54 -04:00
power.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
process_32.c sparc, exec: remove redundant addr_limit assignment 2011-09-20 23:12:42 -07:00
process_64.c nohz: Remove tick_nohz_idle_enter_norcu() / tick_nohz_idle_exit_norcu() 2011-12-11 10:31:57 -08:00
prom_32.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
prom_64.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
prom_common.c sparc: Use kmemdup rather than duplicating its implementation 2011-12-04 10:46:56 -08:00
prom_irqtrans.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
prom.h of/promtree: make drivers/of/pdt.c no longer sparc-only 2010-10-10 21:53:30 -06:00
psycho_common.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
psycho_common.h sparc: remove references to of_device and to_of_device 2010-07-24 09:58:22 -06:00
ptrace_32.c ptrace: cleanup arch_ptrace() on sparc 2010-10-27 18:03:12 -07:00
ptrace_64.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
reboot.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
rtrap_32.S sparc: keep calling do_signal() as long as pending signals remain 2010-10-26 08:59:55 -07:00
rtrap_64.S sparc: keep calling do_signal() as long as pending signals remain 2010-10-26 08:59:55 -07:00
sbus.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
setup_32.c sparc: Make SPARC use the new is_idle_task() API 2011-12-11 10:31:49 -08:00
setup_64.c sparc64: Patch sun4v code sequences properly on module load. 2011-11-17 22:44:58 -08:00
signal32.c sparc: Stash orig_i0 into %g6 instead of %g2 2011-11-15 12:57:00 -08:00
signal_32.c sparc: Stash orig_i0 into %g6 instead of %g2 2011-11-15 12:57:00 -08:00
signal_64.c sparc: Stash orig_i0 into %g6 instead of %g2 2011-11-15 12:57:00 -08:00
sigutil_32.c sparc: Allow handling signals when stack is corrupted. 2011-08-20 17:14:54 -07:00
sigutil_64.c sparc: sigutil: Include <linux/errno.h> 2011-11-13 20:53:25 -08:00
sigutil.h sparc: Allow handling signals when stack is corrupted. 2011-08-20 17:14:54 -07:00
smp_32.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
smp_64.c treewide: Fix typos in various parts of the kernel, and fix some comments. 2011-12-02 14:57:31 +01:00
sparc_ksyms_32.c sparc: Eliminate PROMLIB_INTERNAL as it does nothing 2009-01-08 16:59:01 -08:00
sparc_ksyms_64.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
spiterrs.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
sstate.c sparc: Set reboot-cmd using reboot data hypervisor call if available. 2011-08-02 21:28:52 -07:00
stacktrace.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
starfire.c sparc: explicitly cast negative phandle checks to s32 2011-01-03 20:02:06 -07:00
sun4c_irq.c sparc32: genirq support 2011-04-19 22:11:40 -07:00
sun4d_irq.c Add support for allocating irqs for bootbus devices 2011-06-07 16:06:33 -07:00
sun4d_smp.c sparc: convert old cpumask API into new one 2011-05-16 13:38:07 -07:00
sun4m_irq.c sparc32: genirq support 2011-04-19 22:11:40 -07:00
sun4m_smp.c sparc: convert old cpumask API into new one 2011-05-16 13:38:07 -07:00
sun4v_ivec.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
sun4v_tlb_miss.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
sys32.S All Arch: remove linkage for sys_nfsservctl system call 2011-08-26 15:09:58 -07:00
sys_sparc32.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
sys_sparc_32.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
sys_sparc_64.c powerpc+sparc64/mm: Remove hack in mmap randomize layout 2011-11-28 11:42:09 +11:00
syscalls.S sparc64: Kill off old sys_perfctr system call and state. 2010-03-03 08:08:49 -08:00
sysfs.c cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem 2011-12-21 14:29:42 -08:00
systbls_32.S sparc: Hook up process_vm_{readv,writev} syscalls. 2011-11-01 00:51:30 -07:00
systbls_64.S sparc: Hook up process_vm_{readv,writev} syscalls. 2011-11-01 00:51:30 -07:00
systbls.h improve sys_newuname() for compat architectures 2010-03-12 15:52:32 -08:00
tadpole.c of/sparc: convert various prom_* functions to use phandle 2010-10-09 02:33:34 -06:00
time_32.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 2011-05-20 12:59:54 -07:00
time_64.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
trampoline_32.S sparc,leon: Sparc-Leon SMP support 2009-11-02 04:19:42 -08:00
trampoline_64.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
traps_32.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
traps_64.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
tsb.S sparc64: Fix sun4u execute bit check in TSB I-TLB load. 2010-02-19 15:19:52 -08:00
ttable.S sparc64: fix the build error due to smp_kgdb_capture_client() 2010-06-25 11:17:57 -07:00
una_asm_32.S sparc32: unaligned memory access (MNA) trap handler bug 2011-02-01 12:39:59 -08:00
una_asm_64.S sparc: Fix .size directive for do_int_load 2011-03-16 18:19:15 -07:00
unaligned_32.c sparc: remove several unnecessary module.h include instances 2011-10-31 19:30:54 -04:00
unaligned_64.c sparc: Use hweight64() in popc emulation. 2011-08-02 21:28:50 -07:00
us2e_cpufreq.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
us3_cpufreq.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
utrap.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
vio.c sparc: add export.h to arch/sparc files as required 2011-10-31 19:30:52 -04:00
viohs.c sparc: move symbol exporters to use export.h not module.h 2011-10-31 19:30:53 -04:00
visemul.c sparc64: Fix masking and shifting in VIS fpcmp emulation. 2011-10-31 01:05:49 -07:00
vmlinux.lds.S sparc: Access kernel TSB using physical addressing when possible. 2011-08-05 00:53:57 -07:00
windows.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
winfixup.S sparc,sparc64: unify kernel/ 2008-12-04 09:17:21 -08:00
wof.S
wuf.S