linux/arch/ia64
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
..
configs Merge branch 'misc-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux 2011-11-02 16:52:17 -07:00
dig iommu: Rename the DMAR and INTR_REMAP config options 2011-09-21 10:22:03 +02:00
hp ia64: Add export.h to arch/ia64 specific files as required 2011-10-31 19:30:58 -04:00
include/asm Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
kernel Audit: push audit success and retcode into arch ptrace.h 2012-01-17 16:16:56 -05:00
kvm KVM: IA64: fix struct redefinition 2011-12-27 11:17:43 +02:00
lib Fix common misspellings 2011-03-31 11:26:23 -03:00
mm ia64: Use HAVE_MEMBLOCK_NODE_MAP 2011-12-08 10:22:08 -08:00
oprofile [IA64] fix build warning in arch/ia64/oprofile/backtrace.c 2011-04-07 11:05:56 -07:00
pci ia64/PCI: convert to pci_create_root_bus() for correct root bus resources 2012-01-06 12:10:58 -08:00
scripts scripts: change scripts to use system python instead of env 2010-02-02 14:33:56 +01:00
sn ia64: pcibr: Use kmemdup rather than duplicating its implementation 2011-12-09 15:22:44 -08:00
uv ia64: change to new flag variables 2011-03-17 14:02:56 +01:00
xen 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
install.sh kbuild: use INSTALLKERNEL to select customized installkernel script 2009-09-20 12:18:14 +02:00
Kconfig lib: use generic pci_iomap on all architectures 2012-01-10 18:04:27 -08:00
Kconfig.debug
Makefile Merge commit 'v2.6.35' into kbuild/kbuild 2010-08-04 13:59:13 +02:00
module.lds