2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* Compatibility mode system call entry point for x86-64.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2002 Andi Kleen, SuSE Labs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm/dwarf2.h>
|
|
|
|
#include <asm/calling.h>
|
2005-09-09 21:28:48 +02:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <asm/current.h>
|
|
|
|
#include <asm/errno.h>
|
|
|
|
#include <asm/ia32_unistd.h>
|
|
|
|
#include <asm/thread_info.h>
|
|
|
|
#include <asm/segment.h>
|
2006-07-03 09:24:45 +02:00
|
|
|
#include <asm/irqflags.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
2008-06-24 10:13:31 +02:00
|
|
|
/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
|
|
|
|
#include <linux/elf-em.h>
|
|
|
|
#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
|
|
|
|
#define __AUDIT_ARCH_LE 0x40000000
|
|
|
|
|
|
|
|
#ifndef CONFIG_AUDITSYSCALL
|
2009-09-30 12:22:11 +02:00
|
|
|
#define sysexit_audit ia32_ret_from_sys_call
|
|
|
|
#define sysretl_audit ia32_ret_from_sys_call
|
2008-06-24 10:13:31 +02:00
|
|
|
#endif
|
|
|
|
|
2011-03-07 19:10:39 +01:00
|
|
|
.section .entry.text, "ax"
|
|
|
|
|
2006-04-07 19:50:31 +02:00
|
|
|
#define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8)
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
.macro IA32_ARG_FIXUP noebp=0
|
|
|
|
movl %edi,%r8d
|
|
|
|
.if \noebp
|
|
|
|
.else
|
|
|
|
movl %ebp,%r9d
|
|
|
|
.endif
|
|
|
|
xchg %ecx,%esi
|
|
|
|
movl %ebx,%edi
|
|
|
|
movl %edx,%edx /* zero extension */
|
|
|
|
.endm
|
|
|
|
|
|
|
|
/* clobbers %eax */
|
2009-09-30 12:22:11 +02:00
|
|
|
.macro CLEAR_RREGS offset=0, _r9=rax
|
2005-04-17 00:20:36 +02:00
|
|
|
xorl %eax,%eax
|
2009-09-30 12:22:11 +02:00
|
|
|
movq %rax,\offset+R11(%rsp)
|
|
|
|
movq %rax,\offset+R10(%rsp)
|
|
|
|
movq %\_r9,\offset+R9(%rsp)
|
|
|
|
movq %rax,\offset+R8(%rsp)
|
2005-04-17 00:20:36 +02:00
|
|
|
.endm
|
|
|
|
|
2008-07-09 11:38:07 +02:00
|
|
|
/*
|
|
|
|
* Reload arg registers from stack in case ptrace changed them.
|
|
|
|
* We don't reload %eax because syscall_trace_enter() returned
|
2010-09-14 21:22:58 +02:00
|
|
|
* the %rax value we should see. Instead, we just truncate that
|
|
|
|
* value to 32 bits again as we did on entry from user mode.
|
|
|
|
* If it's a new value set by user_regset during entry tracing,
|
|
|
|
* this matches the normal truncation of the user-mode value.
|
|
|
|
* If it's -1 to make us punt the syscall, then (u32)-1 is still
|
|
|
|
* an appropriately invalid value.
|
2008-07-09 11:38:07 +02:00
|
|
|
*/
|
2008-08-29 14:21:11 +02:00
|
|
|
.macro LOAD_ARGS32 offset, _r9=0
|
|
|
|
.if \_r9
|
2007-09-21 16:16:18 +02:00
|
|
|
movl \offset+16(%rsp),%r9d
|
2008-08-29 14:21:11 +02:00
|
|
|
.endif
|
2007-09-21 16:16:18 +02:00
|
|
|
movl \offset+40(%rsp),%ecx
|
|
|
|
movl \offset+48(%rsp),%edx
|
|
|
|
movl \offset+56(%rsp),%esi
|
|
|
|
movl \offset+64(%rsp),%edi
|
2010-09-14 21:22:58 +02:00
|
|
|
movl %eax,%eax /* zero extension */
|
2007-09-21 16:16:18 +02:00
|
|
|
.endm
|
|
|
|
|
2006-01-11 22:41:59 +01:00
|
|
|
.macro CFI_STARTPROC32 simple
|
|
|
|
CFI_STARTPROC \simple
|
|
|
|
CFI_UNDEFINED r8
|
|
|
|
CFI_UNDEFINED r9
|
|
|
|
CFI_UNDEFINED r10
|
|
|
|
CFI_UNDEFINED r11
|
|
|
|
CFI_UNDEFINED r12
|
|
|
|
CFI_UNDEFINED r13
|
|
|
|
CFI_UNDEFINED r14
|
|
|
|
CFI_UNDEFINED r15
|
|
|
|
.endm
|
|
|
|
|
2008-06-25 06:19:28 +02:00
|
|
|
#ifdef CONFIG_PARAVIRT
|
|
|
|
ENTRY(native_usergs_sysret32)
|
|
|
|
swapgs
|
|
|
|
sysretl
|
|
|
|
ENDPROC(native_usergs_sysret32)
|
|
|
|
|
|
|
|
ENTRY(native_irq_enable_sysexit)
|
|
|
|
swapgs
|
|
|
|
sti
|
|
|
|
sysexit
|
|
|
|
ENDPROC(native_irq_enable_sysexit)
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* 32bit SYSENTER instruction entry.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* %eax System call number.
|
|
|
|
* %ebx Arg1
|
|
|
|
* %ecx Arg2
|
|
|
|
* %edx Arg3
|
|
|
|
* %esi Arg4
|
|
|
|
* %edi Arg5
|
|
|
|
* %ebp user stack
|
|
|
|
* 0(%ebp) Arg6
|
|
|
|
*
|
|
|
|
* Interrupts off.
|
|
|
|
*
|
|
|
|
* This is purely a fast path. For anything complicated we use the int 0x80
|
|
|
|
* path below. Set up a complete hardware stack frame to share code
|
|
|
|
* with the int 0x80 path.
|
|
|
|
*/
|
|
|
|
ENTRY(ia32_sysenter_target)
|
2006-01-11 22:41:59 +01:00
|
|
|
CFI_STARTPROC32 simple
|
2006-09-26 10:52:41 +02:00
|
|
|
CFI_SIGNAL_FRAME
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_DEF_CFA rsp,0
|
|
|
|
CFI_REGISTER rsp,rbp
|
2008-06-26 16:28:51 +02:00
|
|
|
SWAPGS_UNSAFE_STACK
|
2009-01-18 16:38:58 +01:00
|
|
|
movq PER_CPU_VAR(kernel_stack), %rsp
|
|
|
|
addq $(KERNEL_STACK_OFFSET),%rsp
|
2006-07-03 09:24:45 +02:00
|
|
|
/*
|
|
|
|
* No need to follow this irqs on/off section: the syscall
|
|
|
|
* disabled irqs, here we enable it straight after entry:
|
|
|
|
*/
|
2008-06-25 06:19:29 +02:00
|
|
|
ENABLE_INTERRUPTS(CLBR_NONE)
|
2005-04-17 00:20:36 +02:00
|
|
|
movl %ebp,%ebp /* zero extension */
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi $__USER32_DS
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_REL_OFFSET ss,0*/
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi %rbp
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REL_OFFSET rsp,0
|
2011-02-28 16:54:40 +01:00
|
|
|
pushfq_cfi
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_REL_OFFSET rflags,0*/
|
2008-06-24 16:19:35 +02:00
|
|
|
movl 8*3-THREAD_SIZE+TI_sysenter_return(%rsp), %r10d
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REGISTER rip,r10
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi $__USER32_CS
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_REL_OFFSET cs,0*/
|
2005-04-17 00:20:36 +02:00
|
|
|
movl %eax, %eax
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi %r10
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REL_OFFSET rip,0
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi %rax
|
2005-04-17 00:20:36 +02:00
|
|
|
cld
|
2011-05-31 22:21:52 +02:00
|
|
|
SAVE_ARGS 0,1,0
|
2005-04-17 00:20:36 +02:00
|
|
|
/* no need to do an access_ok check here because rbp has been
|
|
|
|
32bit zero extended */
|
2008-08-29 14:21:11 +02:00
|
|
|
1: movl (%rbp),%ebp
|
2005-04-17 00:20:36 +02:00
|
|
|
.section __ex_table,"a"
|
|
|
|
.quad 1b,ia32_badarg
|
|
|
|
.previous
|
|
|
|
GET_THREAD_INFO(%r10)
|
2008-06-24 16:19:35 +02:00
|
|
|
orl $TS_COMPAT,TI_status(%r10)
|
2008-07-09 11:38:07 +02:00
|
|
|
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REMEMBER_STATE
|
2005-04-17 00:20:36 +02:00
|
|
|
jnz sysenter_tracesys
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2006-04-07 19:50:31 +02:00
|
|
|
ja ia32_badsys
|
2008-07-09 11:38:07 +02:00
|
|
|
sysenter_do_call:
|
2008-08-29 14:21:11 +02:00
|
|
|
IA32_ARG_FIXUP
|
2008-06-24 10:13:31 +02:00
|
|
|
sysenter_dispatch:
|
2005-04-17 00:20:36 +02:00
|
|
|
call *ia32_sys_call_table(,%rax,8)
|
|
|
|
movq %rax,RAX-ARGOFFSET(%rsp)
|
|
|
|
GET_THREAD_INFO(%r10)
|
2008-06-25 06:19:29 +02:00
|
|
|
DISABLE_INTERRUPTS(CLBR_NONE)
|
2006-07-03 09:24:45 +02:00
|
|
|
TRACE_IRQS_OFF
|
2008-06-24 16:19:35 +02:00
|
|
|
testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
|
2008-06-24 10:13:31 +02:00
|
|
|
jnz sysexit_audit
|
|
|
|
sysexit_from_sys_call:
|
2008-06-24 16:19:35 +02:00
|
|
|
andl $~TS_COMPAT,TI_status(%r10)
|
2005-04-17 00:20:36 +02:00
|
|
|
/* clear IF, that popfq doesn't enable interrupts early */
|
|
|
|
andl $~0x200,EFLAGS-R11(%rsp)
|
2008-01-30 13:30:43 +01:00
|
|
|
movl RIP-R11(%rsp),%edx /* User %eip */
|
|
|
|
CFI_REGISTER rip,rdx
|
2011-05-31 22:21:53 +02:00
|
|
|
RESTORE_ARGS 0,24,0,0,0,0
|
2009-09-30 12:22:11 +02:00
|
|
|
xorq %r8,%r8
|
|
|
|
xorq %r9,%r9
|
|
|
|
xorq %r10,%r10
|
|
|
|
xorq %r11,%r11
|
2011-02-28 16:54:40 +01:00
|
|
|
popfq_cfi
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_RESTORE rflags*/
|
2011-02-28 16:54:40 +01:00
|
|
|
popq_cfi %rcx /* User %esp */
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REGISTER rsp,rcx
|
2006-07-03 09:24:45 +02:00
|
|
|
TRACE_IRQS_ON
|
2008-06-25 06:19:28 +02:00
|
|
|
ENABLE_INTERRUPTS_SYSEXIT32
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-06-24 10:13:31 +02:00
|
|
|
#ifdef CONFIG_AUDITSYSCALL
|
|
|
|
.macro auditsys_entry_common
|
|
|
|
movl %esi,%r9d /* 6th arg: 4th syscall arg */
|
|
|
|
movl %edx,%r8d /* 5th arg: 3rd syscall arg */
|
|
|
|
/* (already in %ecx) 4th arg: 2nd syscall arg */
|
|
|
|
movl %ebx,%edx /* 3rd arg: 1st syscall arg */
|
|
|
|
movl %eax,%esi /* 2nd arg: syscall number */
|
|
|
|
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
|
|
|
call audit_syscall_entry
|
|
|
|
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2008-06-24 10:13:31 +02:00
|
|
|
ja ia32_badsys
|
|
|
|
movl %ebx,%edi /* reload 1st syscall arg */
|
|
|
|
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
|
|
|
movl RDX-ARGOFFSET(%rsp),%edx /* reload 3rd syscall arg */
|
|
|
|
movl RSI-ARGOFFSET(%rsp),%ecx /* reload 4th syscall arg */
|
|
|
|
movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
|
|
|
|
.endm
|
|
|
|
|
2009-10-26 16:20:29 +01:00
|
|
|
.macro auditsys_exit exit
|
2008-06-24 10:13:31 +02:00
|
|
|
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
|
2009-09-30 12:22:11 +02:00
|
|
|
jnz ia32_ret_from_sys_call
|
2008-06-24 10:13:31 +02:00
|
|
|
TRACE_IRQS_ON
|
|
|
|
sti
|
|
|
|
movl %eax,%esi /* second arg, syscall return value */
|
|
|
|
cmpl $0,%eax /* is it < 0? */
|
|
|
|
setl %al /* 1 if so, 0 if not */
|
|
|
|
movzbl %al,%edi /* zero-extend that into %edi */
|
|
|
|
inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */
|
|
|
|
call audit_syscall_exit
|
|
|
|
GET_THREAD_INFO(%r10)
|
|
|
|
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
|
|
|
|
movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
|
|
|
|
cli
|
|
|
|
TRACE_IRQS_OFF
|
|
|
|
testl %edi,TI_flags(%r10)
|
2009-09-30 12:22:11 +02:00
|
|
|
jz \exit
|
|
|
|
CLEAR_RREGS -ARGOFFSET
|
|
|
|
jmp int_with_check
|
2008-06-24 10:13:31 +02:00
|
|
|
.endm
|
|
|
|
|
|
|
|
sysenter_auditsys:
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_RESTORE_STATE
|
2008-06-24 10:13:31 +02:00
|
|
|
auditsys_entry_common
|
|
|
|
movl %ebp,%r9d /* reload 6th syscall arg */
|
|
|
|
jmp sysenter_dispatch
|
|
|
|
|
|
|
|
sysexit_audit:
|
|
|
|
auditsys_exit sysexit_from_sys_call
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sysenter_tracesys:
|
|
|
|
#ifdef CONFIG_AUDITSYSCALL
|
|
|
|
testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
|
|
|
|
jz sysenter_auditsys
|
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
SAVE_REST
|
|
|
|
CLEAR_RREGS
|
2008-03-19 02:23:50 +01:00
|
|
|
movq $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
|
2005-04-17 00:20:36 +02:00
|
|
|
movq %rsp,%rdi /* &pt_regs -> arg1 */
|
|
|
|
call syscall_trace_enter
|
2007-09-21 16:16:18 +02:00
|
|
|
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
2005-04-17 00:20:36 +02:00
|
|
|
RESTORE_REST
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2008-03-19 02:23:50 +01:00
|
|
|
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
2005-04-17 00:20:36 +02:00
|
|
|
jmp sysenter_do_call
|
|
|
|
CFI_ENDPROC
|
2006-06-26 13:56:55 +02:00
|
|
|
ENDPROC(ia32_sysenter_target)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 32bit SYSCALL instruction entry.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* %eax System call number.
|
|
|
|
* %ebx Arg1
|
|
|
|
* %ecx return EIP
|
|
|
|
* %edx Arg3
|
|
|
|
* %esi Arg4
|
|
|
|
* %edi Arg5
|
|
|
|
* %ebp Arg2 [note: not saved in the stack frame, should not be touched]
|
|
|
|
* %esp user stack
|
|
|
|
* 0(%esp) Arg6
|
|
|
|
*
|
|
|
|
* Interrupts off.
|
|
|
|
*
|
|
|
|
* This is purely a fast path. For anything complicated we use the int 0x80
|
|
|
|
* path below. Set up a complete hardware stack frame to share code
|
|
|
|
* with the int 0x80 path.
|
|
|
|
*/
|
|
|
|
ENTRY(ia32_cstar_target)
|
2006-01-11 22:41:59 +01:00
|
|
|
CFI_STARTPROC32 simple
|
2006-09-26 10:52:41 +02:00
|
|
|
CFI_SIGNAL_FRAME
|
2009-01-18 16:38:58 +01:00
|
|
|
CFI_DEF_CFA rsp,KERNEL_STACK_OFFSET
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REGISTER rip,rcx
|
|
|
|
/*CFI_REGISTER rflags,r11*/
|
2008-06-26 16:28:51 +02:00
|
|
|
SWAPGS_UNSAFE_STACK
|
2005-04-17 00:20:36 +02:00
|
|
|
movl %esp,%r8d
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REGISTER rsp,r8
|
2009-01-18 16:38:58 +01:00
|
|
|
movq PER_CPU_VAR(kernel_stack),%rsp
|
2006-07-03 09:24:45 +02:00
|
|
|
/*
|
|
|
|
* No need to follow this irqs on/off section: the syscall
|
|
|
|
* disabled irqs and here we enable it straight after entry:
|
|
|
|
*/
|
2008-06-25 06:19:29 +02:00
|
|
|
ENABLE_INTERRUPTS(CLBR_NONE)
|
2011-05-31 22:21:52 +02:00
|
|
|
SAVE_ARGS 8,0,0
|
2005-04-17 00:20:36 +02:00
|
|
|
movl %eax,%eax /* zero extension */
|
|
|
|
movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
|
|
|
|
movq %rcx,RIP-ARGOFFSET(%rsp)
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REL_OFFSET rip,RIP-ARGOFFSET
|
2005-04-17 00:20:36 +02:00
|
|
|
movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
|
|
|
|
movl %ebp,%ecx
|
|
|
|
movq $__USER32_CS,CS-ARGOFFSET(%rsp)
|
|
|
|
movq $__USER32_DS,SS-ARGOFFSET(%rsp)
|
|
|
|
movq %r11,EFLAGS-ARGOFFSET(%rsp)
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
|
2005-04-17 00:20:36 +02:00
|
|
|
movq %r8,RSP-ARGOFFSET(%rsp)
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REL_OFFSET rsp,RSP-ARGOFFSET
|
2005-04-17 00:20:36 +02:00
|
|
|
/* no need to do an access_ok check here because r8 has been
|
|
|
|
32bit zero extended */
|
|
|
|
/* hardware stack frame is complete now */
|
|
|
|
1: movl (%r8),%r9d
|
|
|
|
.section __ex_table,"a"
|
|
|
|
.quad 1b,ia32_badarg
|
|
|
|
.previous
|
|
|
|
GET_THREAD_INFO(%r10)
|
2008-06-24 16:19:35 +02:00
|
|
|
orl $TS_COMPAT,TI_status(%r10)
|
2008-07-09 11:38:07 +02:00
|
|
|
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REMEMBER_STATE
|
2005-04-17 00:20:36 +02:00
|
|
|
jnz cstar_tracesys
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $IA32_NR_syscalls-1,%rax
|
2006-04-07 19:50:31 +02:00
|
|
|
ja ia32_badsys
|
2008-08-29 14:21:11 +02:00
|
|
|
cstar_do_call:
|
2005-04-17 00:20:36 +02:00
|
|
|
IA32_ARG_FIXUP 1
|
2008-06-24 10:13:31 +02:00
|
|
|
cstar_dispatch:
|
2005-04-17 00:20:36 +02:00
|
|
|
call *ia32_sys_call_table(,%rax,8)
|
|
|
|
movq %rax,RAX-ARGOFFSET(%rsp)
|
|
|
|
GET_THREAD_INFO(%r10)
|
2008-06-25 06:19:29 +02:00
|
|
|
DISABLE_INTERRUPTS(CLBR_NONE)
|
2006-07-03 09:24:45 +02:00
|
|
|
TRACE_IRQS_OFF
|
2008-06-24 16:19:35 +02:00
|
|
|
testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
|
2008-06-24 10:13:31 +02:00
|
|
|
jnz sysretl_audit
|
|
|
|
sysretl_from_sys_call:
|
2008-06-24 16:19:35 +02:00
|
|
|
andl $~TS_COMPAT,TI_status(%r10)
|
2011-05-31 22:21:53 +02:00
|
|
|
RESTORE_ARGS 0,-ARG_SKIP,0,0,0
|
2005-04-17 00:20:36 +02:00
|
|
|
movl RIP-ARGOFFSET(%rsp),%ecx
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_REGISTER rip,rcx
|
2005-04-17 00:20:36 +02:00
|
|
|
movl EFLAGS-ARGOFFSET(%rsp),%r11d
|
2005-09-12 18:49:24 +02:00
|
|
|
/*CFI_REGISTER rflags,r11*/
|
2009-09-30 12:22:11 +02:00
|
|
|
xorq %r10,%r10
|
|
|
|
xorq %r9,%r9
|
|
|
|
xorq %r8,%r8
|
2006-07-03 09:24:45 +02:00
|
|
|
TRACE_IRQS_ON
|
2005-04-17 00:20:36 +02:00
|
|
|
movl RSP-ARGOFFSET(%rsp),%esp
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_RESTORE rsp
|
2008-06-25 06:19:28 +02:00
|
|
|
USERGS_SYSRET32
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-06-24 10:13:31 +02:00
|
|
|
#ifdef CONFIG_AUDITSYSCALL
|
|
|
|
cstar_auditsys:
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_RESTORE_STATE
|
2008-06-24 10:13:31 +02:00
|
|
|
movl %r9d,R9-ARGOFFSET(%rsp) /* register to be clobbered by call */
|
|
|
|
auditsys_entry_common
|
|
|
|
movl R9-ARGOFFSET(%rsp),%r9d /* reload 6th syscall arg */
|
|
|
|
jmp cstar_dispatch
|
|
|
|
|
|
|
|
sysretl_audit:
|
2009-10-26 16:20:29 +01:00
|
|
|
auditsys_exit sysretl_from_sys_call
|
2008-06-24 10:13:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
cstar_tracesys:
|
|
|
|
#ifdef CONFIG_AUDITSYSCALL
|
|
|
|
testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
|
|
|
|
jz cstar_auditsys
|
|
|
|
#endif
|
2007-11-07 16:48:39 +01:00
|
|
|
xchgl %r9d,%ebp
|
2005-04-17 00:20:36 +02:00
|
|
|
SAVE_REST
|
2009-09-30 12:22:11 +02:00
|
|
|
CLEAR_RREGS 0, r9
|
2008-03-19 02:23:50 +01:00
|
|
|
movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
|
2005-04-17 00:20:36 +02:00
|
|
|
movq %rsp,%rdi /* &pt_regs -> arg1 */
|
|
|
|
call syscall_trace_enter
|
2008-08-29 14:21:11 +02:00
|
|
|
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
2005-04-17 00:20:36 +02:00
|
|
|
RESTORE_REST
|
2007-11-07 16:48:39 +01:00
|
|
|
xchgl %ebp,%r9d
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2008-03-19 02:23:50 +01:00
|
|
|
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
2005-04-17 00:20:36 +02:00
|
|
|
jmp cstar_do_call
|
2006-06-26 13:56:55 +02:00
|
|
|
END(ia32_cstar_target)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
ia32_badarg:
|
|
|
|
movq $-EFAULT,%rax
|
|
|
|
jmp ia32_sysret
|
|
|
|
CFI_ENDPROC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Emulated IA32 system calls via int 0x80.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* %eax System call number.
|
|
|
|
* %ebx Arg1
|
|
|
|
* %ecx Arg2
|
|
|
|
* %edx Arg3
|
|
|
|
* %esi Arg4
|
|
|
|
* %edi Arg5
|
|
|
|
* %ebp Arg6 [note: not saved in the stack frame, should not be touched]
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* Uses the same stack frame as the x86-64 version.
|
|
|
|
* All registers except %eax must be saved (but ptrace may violate that)
|
|
|
|
* Arguments are zero extended. For system calls that want sign extension and
|
|
|
|
* take long arguments a wrapper is needed. Most calls can just be called
|
|
|
|
* directly.
|
|
|
|
* Assumes it is only called from user space and entered with interrupts off.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ENTRY(ia32_syscall)
|
2007-07-21 17:10:20 +02:00
|
|
|
CFI_STARTPROC32 simple
|
2006-09-26 10:52:41 +02:00
|
|
|
CFI_SIGNAL_FRAME
|
2005-09-12 18:49:24 +02:00
|
|
|
CFI_DEF_CFA rsp,SS+8-RIP
|
|
|
|
/*CFI_REL_OFFSET ss,SS-RIP*/
|
|
|
|
CFI_REL_OFFSET rsp,RSP-RIP
|
|
|
|
/*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
|
|
|
|
/*CFI_REL_OFFSET cs,CS-RIP*/
|
|
|
|
CFI_REL_OFFSET rip,RIP-RIP
|
2008-07-09 00:06:28 +02:00
|
|
|
PARAVIRT_ADJUST_EXCEPTION_FRAME
|
2008-06-25 06:19:29 +02:00
|
|
|
SWAPGS
|
2006-07-03 09:24:45 +02:00
|
|
|
/*
|
|
|
|
* No need to follow this irqs on/off section: the syscall
|
|
|
|
* disabled irqs and here we enable it straight after entry:
|
|
|
|
*/
|
2008-06-25 06:19:29 +02:00
|
|
|
ENABLE_INTERRUPTS(CLBR_NONE)
|
2005-04-17 00:20:36 +02:00
|
|
|
movl %eax,%eax
|
2011-02-28 16:54:40 +01:00
|
|
|
pushq_cfi %rax
|
2005-04-17 00:20:36 +02:00
|
|
|
cld
|
|
|
|
/* note the registers are not zero extended to the sf.
|
|
|
|
this could be a problem. */
|
2011-05-31 22:21:52 +02:00
|
|
|
SAVE_ARGS 0,1,0
|
2005-04-17 00:20:36 +02:00
|
|
|
GET_THREAD_INFO(%r10)
|
2008-06-24 16:19:35 +02:00
|
|
|
orl $TS_COMPAT,TI_status(%r10)
|
2008-07-09 11:38:07 +02:00
|
|
|
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
2005-04-17 00:20:36 +02:00
|
|
|
jnz ia32_tracesys
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2009-02-07 03:15:18 +01:00
|
|
|
ja ia32_badsys
|
|
|
|
ia32_do_call:
|
2005-04-17 00:20:36 +02:00
|
|
|
IA32_ARG_FIXUP
|
|
|
|
call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
|
|
|
|
ia32_sysret:
|
|
|
|
movq %rax,RAX-ARGOFFSET(%rsp)
|
2009-09-30 12:22:11 +02:00
|
|
|
ia32_ret_from_sys_call:
|
|
|
|
CLEAR_RREGS -ARGOFFSET
|
2005-04-17 00:20:36 +02:00
|
|
|
jmp int_ret_from_sys_call
|
|
|
|
|
|
|
|
ia32_tracesys:
|
|
|
|
SAVE_REST
|
2007-07-21 17:10:20 +02:00
|
|
|
CLEAR_RREGS
|
2008-03-17 05:57:41 +01:00
|
|
|
movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
|
2005-04-17 00:20:36 +02:00
|
|
|
movq %rsp,%rdi /* &pt_regs -> arg1 */
|
|
|
|
call syscall_trace_enter
|
2007-09-21 16:16:18 +02:00
|
|
|
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
2005-04-17 00:20:36 +02:00
|
|
|
RESTORE_REST
|
x86-64, compat: Test %rax for the syscall number, not %eax
On 64 bits, we always, by necessity, jump through the system call
table via %rax. For 32-bit system calls, in theory the system call
number is stored in %eax, and the code was testing %eax for a valid
system call number. At one point we loaded the stored value back from
the stack to enforce zero-extension, but that was removed in checkin
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
will not be able to introduce a non-zero-extended number, but it can
happen via ptrace.
Instead of re-introducing the zero-extension, test what we are
actually going to use, i.e. %rax. This only adds a handful of REX
prefixes to the code.
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-14 21:42:41 +02:00
|
|
|
cmpq $(IA32_NR_syscalls-1),%rax
|
2009-02-07 03:15:18 +01:00
|
|
|
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
|
|
|
jmp ia32_do_call
|
2006-06-26 13:56:55 +02:00
|
|
|
END(ia32_syscall)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
ia32_badsys:
|
|
|
|
movq $0,ORIG_RAX-ARGOFFSET(%rsp)
|
2009-09-30 12:22:11 +02:00
|
|
|
movq $-ENOSYS,%rax
|
|
|
|
jmp ia32_sysret
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
quiet_ni_syscall:
|
|
|
|
movq $-ENOSYS,%rax
|
|
|
|
ret
|
|
|
|
CFI_ENDPROC
|
|
|
|
|
|
|
|
.macro PTREGSCALL label, func, arg
|
|
|
|
.globl \label
|
|
|
|
\label:
|
|
|
|
leaq \func(%rip),%rax
|
|
|
|
leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
|
|
|
|
jmp ia32_ptregs_common
|
|
|
|
.endm
|
|
|
|
|
2006-01-11 22:41:59 +01:00
|
|
|
CFI_STARTPROC32
|
2005-09-12 18:49:24 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
|
|
|
|
PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
|
|
|
|
PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
|
|
|
|
PTREGSCALL stub32_execve, sys32_execve, %rcx
|
|
|
|
PTREGSCALL stub32_fork, sys_fork, %rdi
|
|
|
|
PTREGSCALL stub32_clone, sys32_clone, %rdx
|
|
|
|
PTREGSCALL stub32_vfork, sys_vfork, %rdi
|
|
|
|
PTREGSCALL stub32_iopl, sys_iopl, %rsi
|
|
|
|
|
|
|
|
ENTRY(ia32_ptregs_common)
|
|
|
|
popq %r11
|
2006-01-11 22:41:59 +01:00
|
|
|
CFI_ENDPROC
|
|
|
|
CFI_STARTPROC32 simple
|
2006-09-26 10:52:41 +02:00
|
|
|
CFI_SIGNAL_FRAME
|
2006-01-11 22:41:59 +01:00
|
|
|
CFI_DEF_CFA rsp,SS+8-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rax,RAX-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rcx,RCX-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rdx,RDX-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rsi,RSI-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rdi,RDI-ARGOFFSET
|
|
|
|
CFI_REL_OFFSET rip,RIP-ARGOFFSET
|
|
|
|
/* CFI_REL_OFFSET cs,CS-ARGOFFSET*/
|
|
|
|
/* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
|
|
|
|
CFI_REL_OFFSET rsp,RSP-ARGOFFSET
|
|
|
|
/* CFI_REL_OFFSET ss,SS-ARGOFFSET*/
|
2005-04-17 00:20:36 +02:00
|
|
|
SAVE_REST
|
|
|
|
call *%rax
|
|
|
|
RESTORE_REST
|
|
|
|
jmp ia32_sysret /* misbalances the return cache */
|
|
|
|
CFI_ENDPROC
|
2006-06-26 13:56:55 +02:00
|
|
|
END(ia32_ptregs_common)
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-01-06 09:12:05 +01:00
|
|
|
.section .rodata,"a"
|
2005-04-17 00:20:36 +02:00
|
|
|
.align 8
|
|
|
|
ia32_sys_call_table:
|
|
|
|
.quad sys_restart_syscall
|
|
|
|
.quad sys_exit
|
|
|
|
.quad stub32_fork
|
|
|
|
.quad sys_read
|
|
|
|
.quad sys_write
|
2005-09-07 00:18:25 +02:00
|
|
|
.quad compat_sys_open /* 5 */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_close
|
|
|
|
.quad sys32_waitpid
|
|
|
|
.quad sys_creat
|
|
|
|
.quad sys_link
|
|
|
|
.quad sys_unlink /* 10 */
|
|
|
|
.quad stub32_execve
|
|
|
|
.quad sys_chdir
|
|
|
|
.quad compat_sys_time
|
|
|
|
.quad sys_mknod
|
|
|
|
.quad sys_chmod /* 15 */
|
|
|
|
.quad sys_lchown16
|
|
|
|
.quad quiet_ni_syscall /* old break syscall holder */
|
|
|
|
.quad sys_stat
|
|
|
|
.quad sys32_lseek
|
|
|
|
.quad sys_getpid /* 20 */
|
|
|
|
.quad compat_sys_mount /* mount */
|
|
|
|
.quad sys_oldumount /* old_umount */
|
|
|
|
.quad sys_setuid16
|
|
|
|
.quad sys_getuid16
|
|
|
|
.quad compat_sys_stime /* stime */ /* 25 */
|
2008-04-22 21:21:25 +02:00
|
|
|
.quad compat_sys_ptrace /* ptrace */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_alarm
|
|
|
|
.quad sys_fstat /* (old)fstat */
|
|
|
|
.quad sys_pause
|
|
|
|
.quad compat_sys_utime /* 30 */
|
|
|
|
.quad quiet_ni_syscall /* old stty syscall holder */
|
|
|
|
.quad quiet_ni_syscall /* old gtty syscall holder */
|
|
|
|
.quad sys_access
|
|
|
|
.quad sys_nice
|
|
|
|
.quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */
|
|
|
|
.quad sys_sync
|
|
|
|
.quad sys32_kill
|
|
|
|
.quad sys_rename
|
|
|
|
.quad sys_mkdir
|
|
|
|
.quad sys_rmdir /* 40 */
|
|
|
|
.quad sys_dup
|
2009-08-07 00:58:12 +02:00
|
|
|
.quad sys_pipe
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_times
|
|
|
|
.quad quiet_ni_syscall /* old prof syscall holder */
|
|
|
|
.quad sys_brk /* 45 */
|
|
|
|
.quad sys_setgid16
|
|
|
|
.quad sys_getgid16
|
|
|
|
.quad sys_signal
|
|
|
|
.quad sys_geteuid16
|
|
|
|
.quad sys_getegid16 /* 50 */
|
|
|
|
.quad sys_acct
|
|
|
|
.quad sys_umount /* new_umount */
|
|
|
|
.quad quiet_ni_syscall /* old lock syscall holder */
|
|
|
|
.quad compat_sys_ioctl
|
|
|
|
.quad compat_sys_fcntl64 /* 55 */
|
|
|
|
.quad quiet_ni_syscall /* old mpx syscall holder */
|
|
|
|
.quad sys_setpgid
|
|
|
|
.quad quiet_ni_syscall /* old ulimit syscall holder */
|
2010-03-11 00:21:21 +01:00
|
|
|
.quad sys_olduname
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_umask /* 60 */
|
|
|
|
.quad sys_chroot
|
2008-11-28 10:09:09 +01:00
|
|
|
.quad compat_sys_ustat
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_dup2
|
|
|
|
.quad sys_getppid
|
|
|
|
.quad sys_getpgrp /* 65 */
|
|
|
|
.quad sys_setsid
|
|
|
|
.quad sys32_sigaction
|
|
|
|
.quad sys_sgetmask
|
|
|
|
.quad sys_ssetmask
|
|
|
|
.quad sys_setreuid16 /* 70 */
|
|
|
|
.quad sys_setregid16
|
2008-06-18 13:42:11 +02:00
|
|
|
.quad sys32_sigsuspend
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_sigpending
|
|
|
|
.quad sys_sethostname
|
|
|
|
.quad compat_sys_setrlimit /* 75 */
|
|
|
|
.quad compat_sys_old_getrlimit /* old_getrlimit */
|
|
|
|
.quad compat_sys_getrusage
|
2008-10-16 07:02:06 +02:00
|
|
|
.quad compat_sys_gettimeofday
|
|
|
|
.quad compat_sys_settimeofday
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_getgroups16 /* 80 */
|
|
|
|
.quad sys_setgroups16
|
2010-03-11 00:21:13 +01:00
|
|
|
.quad compat_sys_old_select
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_symlink
|
|
|
|
.quad sys_lstat
|
|
|
|
.quad sys_readlink /* 85 */
|
|
|
|
.quad sys_uselib
|
|
|
|
.quad sys_swapon
|
|
|
|
.quad sys_reboot
|
|
|
|
.quad compat_sys_old_readdir
|
|
|
|
.quad sys32_mmap /* 90 */
|
|
|
|
.quad sys_munmap
|
|
|
|
.quad sys_truncate
|
|
|
|
.quad sys_ftruncate
|
|
|
|
.quad sys_fchmod
|
|
|
|
.quad sys_fchown16 /* 95 */
|
|
|
|
.quad sys_getpriority
|
|
|
|
.quad sys_setpriority
|
|
|
|
.quad quiet_ni_syscall /* old profil syscall holder */
|
|
|
|
.quad compat_sys_statfs
|
|
|
|
.quad compat_sys_fstatfs /* 100 */
|
|
|
|
.quad sys_ioperm
|
|
|
|
.quad compat_sys_socketcall
|
|
|
|
.quad sys_syslog
|
|
|
|
.quad compat_sys_setitimer
|
|
|
|
.quad compat_sys_getitimer /* 105 */
|
|
|
|
.quad compat_sys_newstat
|
|
|
|
.quad compat_sys_newlstat
|
|
|
|
.quad compat_sys_newfstat
|
2010-03-11 00:21:21 +01:00
|
|
|
.quad sys_uname
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad stub32_iopl /* 110 */
|
|
|
|
.quad sys_vhangup
|
|
|
|
.quad quiet_ni_syscall /* old "idle" system call */
|
|
|
|
.quad sys32_vm86_warning /* vm86old */
|
|
|
|
.quad compat_sys_wait4
|
|
|
|
.quad sys_swapoff /* 115 */
|
2007-02-10 10:46:00 +01:00
|
|
|
.quad compat_sys_sysinfo
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys32_ipc
|
|
|
|
.quad sys_fsync
|
|
|
|
.quad stub32_sigreturn
|
|
|
|
.quad stub32_clone /* 120 */
|
|
|
|
.quad sys_setdomainname
|
2010-04-20 05:31:02 +02:00
|
|
|
.quad sys_newuname
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_modify_ldt
|
2006-03-26 11:37:29 +02:00
|
|
|
.quad compat_sys_adjtimex
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys32_mprotect /* 125 */
|
|
|
|
.quad compat_sys_sigprocmask
|
|
|
|
.quad quiet_ni_syscall /* create_module */
|
|
|
|
.quad sys_init_module
|
|
|
|
.quad sys_delete_module
|
|
|
|
.quad quiet_ni_syscall /* 130 get_kernel_syms */
|
2007-07-16 08:41:12 +02:00
|
|
|
.quad sys32_quotactl
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_getpgid
|
|
|
|
.quad sys_fchdir
|
|
|
|
.quad quiet_ni_syscall /* bdflush */
|
|
|
|
.quad sys_sysfs /* 135 */
|
|
|
|
.quad sys_personality
|
|
|
|
.quad quiet_ni_syscall /* for afs_syscall */
|
|
|
|
.quad sys_setfsuid16
|
|
|
|
.quad sys_setfsgid16
|
|
|
|
.quad sys_llseek /* 140 */
|
|
|
|
.quad compat_sys_getdents
|
|
|
|
.quad compat_sys_select
|
|
|
|
.quad sys_flock
|
|
|
|
.quad sys_msync
|
|
|
|
.quad compat_sys_readv /* 145 */
|
|
|
|
.quad compat_sys_writev
|
|
|
|
.quad sys_getsid
|
|
|
|
.quad sys_fdatasync
|
2009-04-03 09:59:52 +02:00
|
|
|
.quad compat_sys_sysctl /* sysctl */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_mlock /* 150 */
|
|
|
|
.quad sys_munlock
|
|
|
|
.quad sys_mlockall
|
|
|
|
.quad sys_munlockall
|
|
|
|
.quad sys_sched_setparam
|
|
|
|
.quad sys_sched_getparam /* 155 */
|
|
|
|
.quad sys_sched_setscheduler
|
|
|
|
.quad sys_sched_getscheduler
|
|
|
|
.quad sys_sched_yield
|
|
|
|
.quad sys_sched_get_priority_max
|
|
|
|
.quad sys_sched_get_priority_min /* 160 */
|
2007-03-16 21:07:36 +01:00
|
|
|
.quad sys32_sched_rr_get_interval
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_nanosleep
|
|
|
|
.quad sys_mremap
|
|
|
|
.quad sys_setresuid16
|
|
|
|
.quad sys_getresuid16 /* 165 */
|
|
|
|
.quad sys32_vm86_warning /* vm86 */
|
|
|
|
.quad quiet_ni_syscall /* query_module */
|
|
|
|
.quad sys_poll
|
2011-08-27 00:03:11 +02:00
|
|
|
.quad quiet_ni_syscall /* old nfsservctl */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_setresgid16 /* 170 */
|
|
|
|
.quad sys_getresgid16
|
|
|
|
.quad sys_prctl
|
|
|
|
.quad stub32_rt_sigreturn
|
|
|
|
.quad sys32_rt_sigaction
|
|
|
|
.quad sys32_rt_sigprocmask /* 175 */
|
|
|
|
.quad sys32_rt_sigpending
|
|
|
|
.quad compat_sys_rt_sigtimedwait
|
|
|
|
.quad sys32_rt_sigqueueinfo
|
2008-06-18 13:42:11 +02:00
|
|
|
.quad sys_rt_sigsuspend
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys32_pread /* 180 */
|
|
|
|
.quad sys32_pwrite
|
|
|
|
.quad sys_chown16
|
|
|
|
.quad sys_getcwd
|
|
|
|
.quad sys_capget
|
|
|
|
.quad sys_capset
|
|
|
|
.quad stub32_sigaltstack
|
|
|
|
.quad sys32_sendfile
|
|
|
|
.quad quiet_ni_syscall /* streams1 */
|
|
|
|
.quad quiet_ni_syscall /* streams2 */
|
|
|
|
.quad stub32_vfork /* 190 */
|
|
|
|
.quad compat_sys_getrlimit
|
2009-11-30 23:37:04 +01:00
|
|
|
.quad sys_mmap_pgoff
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys32_truncate64
|
|
|
|
.quad sys32_ftruncate64
|
|
|
|
.quad sys32_stat64 /* 195 */
|
|
|
|
.quad sys32_lstat64
|
|
|
|
.quad sys32_fstat64
|
|
|
|
.quad sys_lchown
|
|
|
|
.quad sys_getuid
|
|
|
|
.quad sys_getgid /* 200 */
|
|
|
|
.quad sys_geteuid
|
|
|
|
.quad sys_getegid
|
|
|
|
.quad sys_setreuid
|
|
|
|
.quad sys_setregid
|
|
|
|
.quad sys_getgroups /* 205 */
|
|
|
|
.quad sys_setgroups
|
|
|
|
.quad sys_fchown
|
|
|
|
.quad sys_setresuid
|
|
|
|
.quad sys_getresuid
|
|
|
|
.quad sys_setresgid /* 210 */
|
|
|
|
.quad sys_getresgid
|
|
|
|
.quad sys_chown
|
|
|
|
.quad sys_setuid
|
|
|
|
.quad sys_setgid
|
|
|
|
.quad sys_setfsuid /* 215 */
|
|
|
|
.quad sys_setfsgid
|
|
|
|
.quad sys_pivot_root
|
|
|
|
.quad sys_mincore
|
|
|
|
.quad sys_madvise
|
|
|
|
.quad compat_sys_getdents64 /* 220 getdents64 */
|
|
|
|
.quad compat_sys_fcntl64
|
|
|
|
.quad quiet_ni_syscall /* tux */
|
|
|
|
.quad quiet_ni_syscall /* security */
|
|
|
|
.quad sys_gettid
|
2007-06-20 12:23:30 +02:00
|
|
|
.quad sys32_readahead /* 225 */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_setxattr
|
|
|
|
.quad sys_lsetxattr
|
|
|
|
.quad sys_fsetxattr
|
|
|
|
.quad sys_getxattr
|
|
|
|
.quad sys_lgetxattr /* 230 */
|
|
|
|
.quad sys_fgetxattr
|
|
|
|
.quad sys_listxattr
|
|
|
|
.quad sys_llistxattr
|
|
|
|
.quad sys_flistxattr
|
|
|
|
.quad sys_removexattr /* 235 */
|
|
|
|
.quad sys_lremovexattr
|
|
|
|
.quad sys_fremovexattr
|
|
|
|
.quad sys_tkill
|
|
|
|
.quad sys_sendfile64
|
|
|
|
.quad compat_sys_futex /* 240 */
|
|
|
|
.quad compat_sys_sched_setaffinity
|
|
|
|
.quad compat_sys_sched_getaffinity
|
2008-01-30 13:30:46 +01:00
|
|
|
.quad sys_set_thread_area
|
|
|
|
.quad sys_get_thread_area
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_io_setup /* 245 */
|
|
|
|
.quad sys_io_destroy
|
|
|
|
.quad compat_sys_io_getevents
|
|
|
|
.quad compat_sys_io_submit
|
|
|
|
.quad sys_io_cancel
|
2007-06-20 12:23:30 +02:00
|
|
|
.quad sys32_fadvise64 /* 250 */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad quiet_ni_syscall /* free_huge_pages */
|
|
|
|
.quad sys_exit_group
|
|
|
|
.quad sys32_lookup_dcookie
|
|
|
|
.quad sys_epoll_create
|
|
|
|
.quad sys_epoll_ctl /* 255 */
|
|
|
|
.quad sys_epoll_wait
|
|
|
|
.quad sys_remap_file_pages
|
|
|
|
.quad sys_set_tid_address
|
2006-01-10 05:52:08 +01:00
|
|
|
.quad compat_sys_timer_create
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_timer_settime /* 260 */
|
|
|
|
.quad compat_sys_timer_gettime
|
|
|
|
.quad sys_timer_getoverrun
|
|
|
|
.quad sys_timer_delete
|
|
|
|
.quad compat_sys_clock_settime
|
|
|
|
.quad compat_sys_clock_gettime /* 265 */
|
|
|
|
.quad compat_sys_clock_getres
|
|
|
|
.quad compat_sys_clock_nanosleep
|
|
|
|
.quad compat_sys_statfs64
|
|
|
|
.quad compat_sys_fstatfs64
|
|
|
|
.quad sys_tgkill /* 270 */
|
|
|
|
.quad compat_sys_utimes
|
|
|
|
.quad sys32_fadvise64_64
|
|
|
|
.quad quiet_ni_syscall /* sys_vserver */
|
|
|
|
.quad sys_mbind
|
|
|
|
.quad compat_sys_get_mempolicy /* 275 */
|
|
|
|
.quad sys_set_mempolicy
|
|
|
|
.quad compat_sys_mq_open
|
|
|
|
.quad sys_mq_unlink
|
|
|
|
.quad compat_sys_mq_timedsend
|
|
|
|
.quad compat_sys_mq_timedreceive /* 280 */
|
|
|
|
.quad compat_sys_mq_notify
|
|
|
|
.quad compat_sys_mq_getsetattr
|
2005-06-25 23:58:02 +02:00
|
|
|
.quad compat_sys_kexec_load /* reserved for kexec */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad compat_sys_waitid
|
2005-07-25 21:19:29 +02:00
|
|
|
.quad quiet_ni_syscall /* 285: sys_altroot */
|
2005-04-17 00:20:36 +02:00
|
|
|
.quad sys_add_key
|
|
|
|
.quad sys_request_key
|
|
|
|
.quad sys_keyctl
|
2005-07-25 21:19:29 +02:00
|
|
|
.quad sys_ioprio_set
|
|
|
|
.quad sys_ioprio_get /* 290 */
|
|
|
|
.quad sys_inotify_init
|
|
|
|
.quad sys_inotify_add_watch
|
|
|
|
.quad sys_inotify_rm_watch
|
2006-01-08 10:00:51 +01:00
|
|
|
.quad sys_migrate_pages
|
2006-01-19 02:43:56 +01:00
|
|
|
.quad compat_sys_openat /* 295 */
|
|
|
|
.quad sys_mkdirat
|
|
|
|
.quad sys_mknodat
|
|
|
|
.quad sys_fchownat
|
2006-02-01 12:04:32 +01:00
|
|
|
.quad compat_sys_futimesat
|
2006-02-12 02:55:47 +01:00
|
|
|
.quad sys32_fstatat /* 300 */
|
2006-01-19 02:43:56 +01:00
|
|
|
.quad sys_unlinkat
|
|
|
|
.quad sys_renameat
|
|
|
|
.quad sys_linkat
|
|
|
|
.quad sys_symlinkat
|
|
|
|
.quad sys_readlinkat /* 305 */
|
|
|
|
.quad sys_fchmodat
|
|
|
|
.quad sys_faccessat
|
2006-09-26 10:52:27 +02:00
|
|
|
.quad compat_sys_pselect6
|
|
|
|
.quad compat_sys_ppoll
|
2006-02-09 00:35:50 +01:00
|
|
|
.quad sys_unshare /* 310 */
|
2006-03-27 11:16:26 +02:00
|
|
|
.quad compat_sys_set_robust_list
|
|
|
|
.quad compat_sys_get_robust_list
|
2006-04-07 19:50:34 +02:00
|
|
|
.quad sys_splice
|
2007-06-20 12:23:30 +02:00
|
|
|
.quad sys32_sync_file_range
|
utimensat implementation
Implement utimensat(2) which is an extension to futimesat(2) in that it
a) supports nano-second resolution for the timestamps
b) allows to selectively ignore the atime/mtime value
c) allows to selectively use the current time for either atime or mtime
d) supports changing the atime/mtime of a symlink itself along the lines
of the BSD lutimes(3) functions
For this change the internally used do_utimes() functions was changed to
accept a timespec time value and an additional flags parameter.
Additionally the sys_utime function was changed to match compat_sys_utime
which already use do_utimes instead of duplicating the work.
Also, the completely missing futimensat() functionality is added. We have
such a function in glibc but we have to resort to using /proc/self/fd/* which
not everybody likes (chroot etc).
Test application (the syscall number will need per-arch editing):
#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <stddef.h>
#include <syscall.h>
#define __NR_utimensat 280
#define UTIME_NOW ((1l << 30) - 1l)
#define UTIME_OMIT ((1l << 30) - 2l)
int
main(void)
{
int status = 0;
int fd = open("ttt", O_RDWR|O_CREAT|O_EXCL, 0666);
if (fd == -1)
error (1, errno, "failed to create test file \"ttt\"");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
error (1, errno, "fstat failed");
struct timespec t[2];
t[0].tv_sec = 0;
t[0].tv_nsec = 0;
t[1].tv_sec = 0;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
struct stat64 st2;
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
{
puts ("atim not reset to zero");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim not reset to zero");
status = 1;
}
if (status != 0)
goto out;
t[0] = st1.st_atim;
t[1].tv_sec = 0;
t[1].tv_nsec = UTIME_OMIT;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
|| st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
{
puts ("atim not set");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim changed from zero");
status = 1;
}
if (status != 0)
goto out;
t[0].tv_sec = 0;
t[0].tv_nsec = UTIME_OMIT;
t[1] = st1.st_mtim;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
|| st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
{
puts ("mtim changed from original time");
status = 1;
}
if (st2.st_mtim.tv_sec != st1.st_mtim.tv_sec
|| st2.st_mtim.tv_nsec != st1.st_mtim.tv_nsec)
{
puts ("mtim not set");
status = 1;
}
if (status != 0)
goto out;
sleep (2);
t[0].tv_sec = 0;
t[0].tv_nsec = UTIME_NOW;
t[1].tv_sec = 0;
t[1].tv_nsec = UTIME_NOW;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
struct timeval tv;
gettimeofday(&tv,NULL);
if (st2.st_atim.tv_sec <= st1.st_atim.tv_sec
|| st2.st_atim.tv_sec > tv.tv_sec)
{
puts ("atim not set to NOW");
status = 1;
}
if (st2.st_mtim.tv_sec <= st1.st_mtim.tv_sec
|| st2.st_mtim.tv_sec > tv.tv_sec)
{
puts ("mtim not set to NOW");
status = 1;
}
if (symlink ("ttt", "tttsym") != 0)
error (1, errno, "cannot create symlink");
t[0].tv_sec = 0;
t[0].tv_nsec = 0;
t[1].tv_sec = 0;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, AT_FDCWD, "tttsym", t, AT_SYMLINK_NOFOLLOW) != 0)
error (1, errno, "utimensat failed");
if (lstat64 ("tttsym", &st2) != 0)
error (1, errno, "lstat failed");
if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
{
puts ("symlink atim not reset to zero");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("symlink mtim not reset to zero");
status = 1;
}
if (status != 0)
goto out;
t[0].tv_sec = 1;
t[0].tv_nsec = 0;
t[1].tv_sec = 1;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, fd, NULL, t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != 1 || st2.st_atim.tv_nsec != 0)
{
puts ("atim not reset to one");
status = 1;
}
if (st2.st_mtim.tv_sec != 1 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim not reset to one");
status = 1;
}
if (status == 0)
puts ("all OK");
out:
close (fd);
unlink ("ttt");
unlink ("tttsym");
return status;
}
[akpm@linux-foundation.org: add missing i386 syscall table entry]
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 09:33:25 +02:00
|
|
|
.quad sys_tee /* 315 */
|
2006-05-01 21:15:48 +02:00
|
|
|
.quad compat_sys_vmsplice
|
2006-06-23 11:03:56 +02:00
|
|
|
.quad compat_sys_move_pages
|
2006-09-26 10:52:28 +02:00
|
|
|
.quad sys_getcpu
|
2007-02-13 13:26:26 +01:00
|
|
|
.quad sys_epoll_pwait
|
utimensat implementation
Implement utimensat(2) which is an extension to futimesat(2) in that it
a) supports nano-second resolution for the timestamps
b) allows to selectively ignore the atime/mtime value
c) allows to selectively use the current time for either atime or mtime
d) supports changing the atime/mtime of a symlink itself along the lines
of the BSD lutimes(3) functions
For this change the internally used do_utimes() functions was changed to
accept a timespec time value and an additional flags parameter.
Additionally the sys_utime function was changed to match compat_sys_utime
which already use do_utimes instead of duplicating the work.
Also, the completely missing futimensat() functionality is added. We have
such a function in glibc but we have to resort to using /proc/self/fd/* which
not everybody likes (chroot etc).
Test application (the syscall number will need per-arch editing):
#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <stddef.h>
#include <syscall.h>
#define __NR_utimensat 280
#define UTIME_NOW ((1l << 30) - 1l)
#define UTIME_OMIT ((1l << 30) - 2l)
int
main(void)
{
int status = 0;
int fd = open("ttt", O_RDWR|O_CREAT|O_EXCL, 0666);
if (fd == -1)
error (1, errno, "failed to create test file \"ttt\"");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
error (1, errno, "fstat failed");
struct timespec t[2];
t[0].tv_sec = 0;
t[0].tv_nsec = 0;
t[1].tv_sec = 0;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
struct stat64 st2;
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
{
puts ("atim not reset to zero");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim not reset to zero");
status = 1;
}
if (status != 0)
goto out;
t[0] = st1.st_atim;
t[1].tv_sec = 0;
t[1].tv_nsec = UTIME_OMIT;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
|| st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
{
puts ("atim not set");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim changed from zero");
status = 1;
}
if (status != 0)
goto out;
t[0].tv_sec = 0;
t[0].tv_nsec = UTIME_OMIT;
t[1] = st1.st_mtim;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
|| st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
{
puts ("mtim changed from original time");
status = 1;
}
if (st2.st_mtim.tv_sec != st1.st_mtim.tv_sec
|| st2.st_mtim.tv_nsec != st1.st_mtim.tv_nsec)
{
puts ("mtim not set");
status = 1;
}
if (status != 0)
goto out;
sleep (2);
t[0].tv_sec = 0;
t[0].tv_nsec = UTIME_NOW;
t[1].tv_sec = 0;
t[1].tv_nsec = UTIME_NOW;
if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
struct timeval tv;
gettimeofday(&tv,NULL);
if (st2.st_atim.tv_sec <= st1.st_atim.tv_sec
|| st2.st_atim.tv_sec > tv.tv_sec)
{
puts ("atim not set to NOW");
status = 1;
}
if (st2.st_mtim.tv_sec <= st1.st_mtim.tv_sec
|| st2.st_mtim.tv_sec > tv.tv_sec)
{
puts ("mtim not set to NOW");
status = 1;
}
if (symlink ("ttt", "tttsym") != 0)
error (1, errno, "cannot create symlink");
t[0].tv_sec = 0;
t[0].tv_nsec = 0;
t[1].tv_sec = 0;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, AT_FDCWD, "tttsym", t, AT_SYMLINK_NOFOLLOW) != 0)
error (1, errno, "utimensat failed");
if (lstat64 ("tttsym", &st2) != 0)
error (1, errno, "lstat failed");
if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
{
puts ("symlink atim not reset to zero");
status = 1;
}
if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
{
puts ("symlink mtim not reset to zero");
status = 1;
}
if (status != 0)
goto out;
t[0].tv_sec = 1;
t[0].tv_nsec = 0;
t[1].tv_sec = 1;
t[1].tv_nsec = 0;
if (syscall(__NR_utimensat, fd, NULL, t, 0) != 0)
error (1, errno, "utimensat failed");
if (fstat64 (fd, &st2) != 0)
error (1, errno, "fstat failed");
if (st2.st_atim.tv_sec != 1 || st2.st_atim.tv_nsec != 0)
{
puts ("atim not reset to one");
status = 1;
}
if (st2.st_mtim.tv_sec != 1 || st2.st_mtim.tv_nsec != 0)
{
puts ("mtim not reset to one");
status = 1;
}
if (status == 0)
puts ("all OK");
out:
close (fd);
unlink ("ttt");
unlink ("tttsym");
return status;
}
[akpm@linux-foundation.org: add missing i386 syscall table entry]
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 09:33:25 +02:00
|
|
|
.quad compat_sys_utimensat /* 320 */
|
2007-05-12 17:27:41 +02:00
|
|
|
.quad compat_sys_signalfd
|
2008-02-05 07:27:28 +01:00
|
|
|
.quad sys_timerfd_create
|
2007-05-11 07:23:20 +02:00
|
|
|
.quad sys_eventfd
|
sys_fallocate() implementation on i386, x86_64 and powerpc
fallocate() is a new system call being proposed here which will allow
applications to preallocate space to any file(s) in a file system.
Each file system implementation that wants to use this feature will need
to support an inode operation called ->fallocate().
Applications can use this feature to avoid fragmentation to certain
level and thus get faster access speed. With preallocation, applications
also get a guarantee of space for particular file(s) - even if later the
the system becomes full.
Currently, glibc provides an interface called posix_fallocate() which
can be used for similar cause. Though this has the advantage of working
on all file systems, but it is quite slow (since it writes zeroes to
each block that has to be preallocated). Without a doubt, file systems
can do this more efficiently within the kernel, by implementing
the proposed fallocate() system call. It is expected that
posix_fallocate() will be modified to call this new system call first
and incase the kernel/filesystem does not implement it, it should fall
back to the current implementation of writing zeroes to the new blocks.
ToDos:
1. Implementation on other architectures (other than i386, x86_64,
and ppc). Patches for s390(x) and ia64 are already available from
previous posts, but it was decided that they should be added later
once fallocate is in the mainline. Hence not including those patches
in this take.
2. Changes to glibc,
a) to support fallocate() system call
b) to make posix_fallocate() and posix_fallocate64() call fallocate()
Signed-off-by: Amit Arora <aarora@in.ibm.com>
2007-07-18 03:42:44 +02:00
|
|
|
.quad sys32_fallocate
|
2008-02-05 07:27:28 +01:00
|
|
|
.quad compat_sys_timerfd_settime /* 325 */
|
|
|
|
.quad compat_sys_timerfd_gettime
|
flag parameters: signalfd
This patch adds the new signalfd4 syscall. It extends the old signalfd
syscall by one parameter which is meant to hold a flag value. In this
patch the only flag support is SFD_CLOEXEC which causes the close-on-exec
flag for the returned file descriptor to be set.
A new name SFD_CLOEXEC is introduced which in this implementation must
have the same value as O_CLOEXEC.
The following test must be adjusted for architectures other than x86 and
x86-64 and in case the syscall numbers changed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef __NR_signalfd4
# ifdef __x86_64__
# define __NR_signalfd4 289
# elif defined __i386__
# define __NR_signalfd4 327
# else
# error "need __NR_signalfd4"
# endif
#endif
#define SFD_CLOEXEC O_CLOEXEC
int
main (void)
{
sigset_t ss;
sigemptyset (&ss);
sigaddset (&ss, SIGUSR1);
int fd = syscall (__NR_signalfd4, -1, &ss, 8, 0);
if (fd == -1)
{
puts ("signalfd4(0) failed");
return 1;
}
int coe = fcntl (fd, F_GETFD);
if (coe == -1)
{
puts ("fcntl failed");
return 1;
}
if (coe & FD_CLOEXEC)
{
puts ("signalfd4(0) set close-on-exec flag");
return 1;
}
close (fd);
fd = syscall (__NR_signalfd4, -1, &ss, 8, SFD_CLOEXEC);
if (fd == -1)
{
puts ("signalfd4(SFD_CLOEXEC) failed");
return 1;
}
coe = fcntl (fd, F_GETFD);
if (coe == -1)
{
puts ("fcntl failed");
return 1;
}
if ((coe & FD_CLOEXEC) == 0)
{
puts ("signalfd4(SFD_CLOEXEC) does not set close-on-exec flag");
return 1;
}
close (fd);
puts ("OK");
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[akpm@linux-foundation.org: add sys_ni stub]
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 06:29:24 +02:00
|
|
|
.quad compat_sys_signalfd4
|
2008-07-24 06:29:25 +02:00
|
|
|
.quad sys_eventfd2
|
2008-07-24 06:29:43 +02:00
|
|
|
.quad sys_epoll_create1
|
2008-12-03 10:39:53 +01:00
|
|
|
.quad sys_dup3 /* 330 */
|
2008-07-24 06:29:30 +02:00
|
|
|
.quad sys_pipe2
|
2008-07-24 06:29:32 +02:00
|
|
|
.quad sys_inotify_init1
|
2009-04-03 01:59:23 +02:00
|
|
|
.quad compat_sys_preadv
|
|
|
|
.quad compat_sys_pwritev
|
2009-04-04 23:01:10 +02:00
|
|
|
.quad compat_sys_rt_tgsigqueueinfo /* 335 */
|
perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!
In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.
Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.
All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)
The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.
Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.
User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)
This patch has been generated via the following script:
FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
sed -i \
-e 's/PERF_EVENT_/PERF_RECORD_/g' \
-e 's/PERF_COUNTER/PERF_EVENT/g' \
-e 's/perf_counter/perf_event/g' \
-e 's/nb_counters/nb_events/g' \
-e 's/swcounter/swevent/g' \
-e 's/tpcounter_event/tp_event/g' \
$FILES
for N in $(find . -name perf_counter.[ch]); do
M=$(echo $N | sed 's/perf_counter/perf_event/g')
mv $N $M
done
FILES=$(find . -name perf_event.*)
sed -i \
-e 's/COUNTER_MASK/REG_MASK/g' \
-e 's/COUNTER/EVENT/g' \
-e 's/\<event\>/event_id/g' \
-e 's/counter/event/g' \
-e 's/Counter/Event/g' \
$FILES
... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.
Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.
( NOTE: 'counters' are still the proper terminology when we deal
with hardware registers - and these sed scripts are a bit
over-eager in renaming them. I've undone some of that, but
in case there's something left where 'counter' would be
better than 'event' we can undo that on an individual basis
instead of touching an otherwise nicely automated patch. )
Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-21 12:02:48 +02:00
|
|
|
.quad sys_perf_event_open
|
2009-10-13 08:40:10 +02:00
|
|
|
.quad compat_sys_recvmmsg
|
2009-12-18 03:24:25 +01:00
|
|
|
.quad sys_fanotify_init
|
2009-12-18 03:24:26 +01:00
|
|
|
.quad sys32_fanotify_mark
|
2010-08-11 00:35:10 +02:00
|
|
|
.quad sys_prlimit64 /* 340 */
|
2011-01-29 14:13:37 +01:00
|
|
|
.quad sys_name_to_handle_at
|
|
|
|
.quad compat_sys_open_by_handle_at
|
2011-02-01 14:52:30 +01:00
|
|
|
.quad compat_sys_clock_adjtime
|
2011-03-10 20:31:30 +01:00
|
|
|
.quad sys_syncfs
|
2011-05-02 22:21:35 +02:00
|
|
|
.quad compat_sys_sendmmsg /* 345 */
|
2011-05-28 04:28:27 +02:00
|
|
|
.quad sys_setns
|
2007-05-12 17:27:41 +02:00
|
|
|
ia32_syscall_end:
|