1
linux/arch/ia64/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
..
cpufreq [CPUFREQ] use dynamic debug instead of custom infrastructure 2011-05-04 11:50:57 -04:00
.gitignore
acpi-ext.c
acpi.c iommu: Rename the DMAR and INTR_REMAP config options 2011-09-21 10:22:03 +02:00
asm-offsets.c
audit.c
brl_emu.c
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
crash.c
cyclone.c ia64: Replace clocksource.fsys_mmio with generic arch data 2011-07-14 17:57:09 -07:00
dma-mapping.c ia64: Add export.h to arch/ia64 specific files as required 2011-10-31 19:30:58 -04:00
efi_stub.S
efi.c efi: Fix argument types for SetVariable() for ia64 2011-08-04 16:03:50 -07:00
elfcore.c
entry.h
entry.S [IA64] Wire up cross memory attach syscalls 2011-11-02 14:00:26 -07:00
err_inject.c cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem 2011-12-21 14:29:42 -08:00
esi_stub.S
esi.c
fsys.S [IA64] Optimize ticket spinlocks in fsys_rt_sigprocmask 2010-09-15 15:35:48 -07:00
fsyscall_gtod_data.h
ftrace.c
gate-data.S
gate.lds.S
gate.S
head.S
ia64_ksyms.c
init_task.c
iosapic.c ia64: iosapic: Use new irq_move_* functions 2011-03-29 14:48:03 +02:00
irq_ia64.c sched: Provide scheduler_ipi() callback in response to smp_send_reschedule() 2011-04-14 08:52:32 +02:00
irq_lsapic.c ia64: Convert lsapic to new irq_chip functions 2011-03-29 14:48:02 +02:00
irq.c ia64: Use generic show_interrupts() 2011-03-29 14:48:05 +02:00
ivt.S Merge branch 'for-35' of git://repo.or.cz/linux-kbuild 2010-06-01 08:55:52 -07:00
jprobes.S
kprobes.c
machine_kexec.c
machvec.c
Makefile iommu: Rename the DMAR and INTR_REMAP config options 2011-09-21 10:22:03 +02:00
Makefile.gate
mca_asm.S
mca_drv_asm.S
mca_drv.c
mca_drv.h
mca.c ia64: Use accessor functions all over the place 2011-03-29 14:48:03 +02:00
minstate.h
module.c modules: make arch's use default loader hooks 2011-07-24 22:06:04 +09:30
msi_ia64.c iommu: Rename the DMAR and INTR_REMAP config options 2011-09-21 10:22:03 +02:00
nr-irqs.c
numa.c
pal.S
palinfo.c [IA64] Use static const char * const in palinfo.c 2010-09-23 14:22:05 -07:00
paravirt_inst.h
paravirt_patch.c
paravirt_patchlist.c
paravirt_patchlist.h
paravirt.c ia64: add jump labels for paravirt 2011-07-14 12:59:45 +03:00
paravirtentry.S
patch.c
pci-dma.c iommu: Add option to group multi-function devices 2011-11-15 12:22:31 +01:00
pci-swiotlb.c ia64: remove unnecessary sync_single_range_* in swiotlb_dma_ops 2010-05-27 09:12:52 -07:00
perfmon_default_smpl.c Fix common misspellings 2011-03-31 11:26:23 -03:00
perfmon_generic.h
perfmon_itanium.h
perfmon_mckinley.h
perfmon_montecito.h
perfmon.c vfs: for usbfs, etc. internal vfsmounts ->mnt_sb->s_root == ->mnt_root 2012-01-03 22:52:41 -05:00
process.c ACPI, intel_idle: Cleanup idle= internal variables 2011-01-12 12:47:30 -05:00
ptrace.c Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
relocate_kernel.S
sal.c
salinfo.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
setup.c [IA64] Merge overlapping reserved regions at boot 2011-12-09 15:06:42 -08:00
sigframe.h
signal.c
smp.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
smpboot.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
stacktrace.c [IA64] Add CONFIG_STACKTRACE_SUPPORT 2010-09-23 13:52:07 -07:00
sys_ia64.c
time.c ia64: Replace clocksource.fsys_mmio with generic arch data 2011-07-14 17:57:09 -07:00
topology.c cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem 2011-12-21 14:29:42 -08:00
traps.c
unaligned.c [IA64] use __ratelimit 2010-05-18 14:45:54 -07:00
uncached.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
unwind_decoder.c
unwind_i.h
unwind.c [IA64] unwind - optimise linked-list searches for modules 2010-09-14 13:35:39 -07:00
vmlinux.lds.S [IA64] define "_sdata" symbol 2011-05-20 10:38:53 -07:00