You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner:
"A set of fixes and updates for x86:
- Address a swiotlb regression which was caused by the recent DMA
rework and made driver fail because dma_direct_supported() returned
false
- Fix a signedness bug in the APIC ID validation which caused invalid
APIC IDs to be detected as valid thereby bloating the CPU possible
space.
- Fix inconsisten config dependcy/select magic for the MFD_CS5535
driver.
- Fix a corruption of the physical address space bits when encryption
has reduced the address space and late cpuinfo updates overwrite
the reduced bit information with the original value.
- Dominiks syscall rework which consolidates the architecture
specific syscall functions so all syscalls can be wrapped with the
same macros. This allows to switch x86/64 to struct pt_regs based
syscalls. Extend the clearing of user space controlled registers in
the entry patch to the lower registers"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/apic: Fix signedness bug in APIC ID validity checks
x86/cpu: Prevent cpuinfo_x86::x86_phys_bits adjustment corruption
x86/olpc: Fix inconsistent MFD_CS5535 configuration
swiotlb: Use dma_direct_supported() for swiotlb_ops
syscalls/x86: Adapt syscall_wrapper.h to the new syscall stub naming convention
syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()
syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
syscalls/core, syscalls/x86: Clean up syscall stub naming convention
syscalls/x86: Extend register clearing on syscall entry to lower registers
syscalls/x86: Unconditionally enable 'struct pt_regs' based syscalls on x86_64
syscalls/x86: Use 'struct pt_regs' based syscall calling for IA32_EMULATION and x32
syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y for compat syscalls
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
x86/syscalls: Don't pointlessly reload the system call number
x86/mm: Fix documentation of module mapping range with 4-level paging
x86/cpuid: Switch to 'static const' specifier
This commit is contained in:
@@ -360,7 +360,7 @@ First, the entry in ``arch/x86/entry/syscalls/syscall_32.tbl`` gets an extra
|
||||
column to indicate that a 32-bit userspace program running on a 64-bit kernel
|
||||
should hit the compat entry point::
|
||||
|
||||
380 i386 xyzzy sys_xyzzy compat_sys_xyzzy
|
||||
380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzy
|
||||
|
||||
Second, you need to figure out what should happen for the x32 ABI version of
|
||||
the new system call. There's a choice here: the layout of the arguments
|
||||
@@ -373,7 +373,7 @@ the compatibility wrapper::
|
||||
|
||||
333 64 xyzzy sys_xyzzy
|
||||
...
|
||||
555 x32 xyzzy compat_sys_xyzzy
|
||||
555 x32 xyzzy __x32_compat_sys_xyzzy
|
||||
|
||||
If no pointers are involved, then it is preferable to re-use the 64-bit system
|
||||
call for the x32 ABI (and consequently the entry in
|
||||
|
||||
@@ -20,7 +20,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
|
||||
ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space
|
||||
... unused hole ...
|
||||
ffffffff80000000 - ffffffff9fffffff (=512 MB) kernel text mapping, from phys 0
|
||||
ffffffffa0000000 - [fixmap start] (~1526 MB) module mapping space (variable)
|
||||
ffffffffa0000000 - fffffffffeffffff (1520 MB) module mapping space
|
||||
[fixmap start] - ffffffffff5fffff kernel-internal fixmap range
|
||||
ffffffffff600000 - ffffffffff600fff (=4 kB) legacy vsyscall ABI
|
||||
ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole
|
||||
|
||||
+2
-3
@@ -29,6 +29,7 @@ config X86_64
|
||||
select HAVE_ARCH_SOFT_DIRTY
|
||||
select MODULES_USE_ELF_RELA
|
||||
select X86_DEV_DMA_OPS
|
||||
select ARCH_HAS_SYSCALL_WRAPPER
|
||||
|
||||
#
|
||||
# Arch settings
|
||||
@@ -2763,11 +2764,9 @@ config OLPC_XO1_RTC
|
||||
|
||||
config OLPC_XO1_SCI
|
||||
bool "OLPC XO-1 SCI extras"
|
||||
depends on OLPC && OLPC_XO1_PM
|
||||
depends on OLPC && OLPC_XO1_PM && GPIO_CS5535=y
|
||||
depends on INPUT=y
|
||||
select POWER_SUPPLY
|
||||
select GPIO_CS5535
|
||||
select MFD_CORE
|
||||
---help---
|
||||
Add support for SCI-based features of the OLPC XO-1 laptop:
|
||||
- EC-driven system wakeups
|
||||
|
||||
@@ -114,7 +114,9 @@ For 32-bit we have the following conventions - kernel is built with
|
||||
pushq %rsi /* pt_regs->si */
|
||||
.endif
|
||||
pushq \rdx /* pt_regs->dx */
|
||||
xorl %edx, %edx /* nospec dx */
|
||||
pushq %rcx /* pt_regs->cx */
|
||||
xorl %ecx, %ecx /* nospec cx */
|
||||
pushq \rax /* pt_regs->ax */
|
||||
pushq %r8 /* pt_regs->r8 */
|
||||
xorl %r8d, %r8d /* nospec r8 */
|
||||
|
||||
+11
-9
@@ -266,14 +266,13 @@ __visible inline void syscall_return_slowpath(struct pt_regs *regs)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
__visible void do_syscall_64(struct pt_regs *regs)
|
||||
__visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
|
||||
{
|
||||
struct thread_info *ti = current_thread_info();
|
||||
unsigned long nr = regs->orig_ax;
|
||||
struct thread_info *ti;
|
||||
|
||||
enter_from_user_mode();
|
||||
local_irq_enable();
|
||||
|
||||
ti = current_thread_info();
|
||||
if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY)
|
||||
nr = syscall_trace_enter(regs);
|
||||
|
||||
@@ -282,11 +281,10 @@ __visible void do_syscall_64(struct pt_regs *regs)
|
||||
* table. The only functional difference is the x32 bit in
|
||||
* regs->orig_ax, which changes the behavior of some syscalls.
|
||||
*/
|
||||
if (likely((nr & __SYSCALL_MASK) < NR_syscalls)) {
|
||||
nr = array_index_nospec(nr & __SYSCALL_MASK, NR_syscalls);
|
||||
regs->ax = sys_call_table[nr](
|
||||
regs->di, regs->si, regs->dx,
|
||||
regs->r10, regs->r8, regs->r9);
|
||||
nr &= __SYSCALL_MASK;
|
||||
if (likely(nr < NR_syscalls)) {
|
||||
nr = array_index_nospec(nr, NR_syscalls);
|
||||
regs->ax = sys_call_table[nr](regs);
|
||||
}
|
||||
|
||||
syscall_return_slowpath(regs);
|
||||
@@ -321,6 +319,9 @@ static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs)
|
||||
|
||||
if (likely(nr < IA32_NR_syscalls)) {
|
||||
nr = array_index_nospec(nr, IA32_NR_syscalls);
|
||||
#ifdef CONFIG_IA32_EMULATION
|
||||
regs->ax = ia32_sys_call_table[nr](regs);
|
||||
#else
|
||||
/*
|
||||
* It's possible that a 32-bit syscall implementation
|
||||
* takes a 64-bit parameter but nonetheless assumes that
|
||||
@@ -331,6 +332,7 @@ static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs)
|
||||
(unsigned int)regs->bx, (unsigned int)regs->cx,
|
||||
(unsigned int)regs->dx, (unsigned int)regs->si,
|
||||
(unsigned int)regs->di, (unsigned int)regs->bp);
|
||||
#endif /* CONFIG_IA32_EMULATION */
|
||||
}
|
||||
|
||||
syscall_return_slowpath(regs);
|
||||
|
||||
@@ -233,7 +233,8 @@ GLOBAL(entry_SYSCALL_64_after_hwframe)
|
||||
TRACE_IRQS_OFF
|
||||
|
||||
/* IRQs are off. */
|
||||
movq %rsp, %rdi
|
||||
movq %rax, %rdi
|
||||
movq %rsp, %rsi
|
||||
call do_syscall_64 /* returns with IRQs disabled */
|
||||
|
||||
TRACE_IRQS_IRETQ /* we're about to change IF */
|
||||
|
||||
@@ -220,8 +220,11 @@ GLOBAL(entry_SYSCALL_compat_after_hwframe)
|
||||
pushq %rax /* pt_regs->orig_ax */
|
||||
pushq %rdi /* pt_regs->di */
|
||||
pushq %rsi /* pt_regs->si */
|
||||
xorl %esi, %esi /* nospec si */
|
||||
pushq %rdx /* pt_regs->dx */
|
||||
xorl %edx, %edx /* nospec dx */
|
||||
pushq %rbp /* pt_regs->cx (stashed in bp) */
|
||||
xorl %ecx, %ecx /* nospec cx */
|
||||
pushq $-ENOSYS /* pt_regs->ax */
|
||||
pushq $0 /* pt_regs->r8 = 0 */
|
||||
xorl %r8d, %r8d /* nospec r8 */
|
||||
@@ -365,8 +368,11 @@ ENTRY(entry_INT80_compat)
|
||||
|
||||
pushq (%rdi) /* pt_regs->di */
|
||||
pushq %rsi /* pt_regs->si */
|
||||
xorl %esi, %esi /* nospec si */
|
||||
pushq %rdx /* pt_regs->dx */
|
||||
xorl %edx, %edx /* nospec dx */
|
||||
pushq %rcx /* pt_regs->cx */
|
||||
xorl %ecx, %ecx /* nospec cx */
|
||||
pushq $-ENOSYS /* pt_regs->ax */
|
||||
pushq $0 /* pt_regs->r8 = 0 */
|
||||
xorl %r8d, %r8d /* nospec r8 */
|
||||
|
||||
@@ -7,14 +7,23 @@
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/syscall.h>
|
||||
|
||||
#define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
|
||||
#ifdef CONFIG_IA32_EMULATION
|
||||
/* On X86_64, we use struct pt_regs * to pass parameters to syscalls */
|
||||
#define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
|
||||
|
||||
/* this is a lie, but it does not hurt as sys_ni_syscall just returns -EINVAL */
|
||||
extern asmlinkage long sys_ni_syscall(const struct pt_regs *);
|
||||
|
||||
#else /* CONFIG_IA32_EMULATION */
|
||||
#define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
#endif /* CONFIG_IA32_EMULATION */
|
||||
|
||||
#include <asm/syscalls_32.h>
|
||||
#undef __SYSCALL_I386
|
||||
|
||||
#define __SYSCALL_I386(nr, sym, qual) [nr] = sym,
|
||||
|
||||
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
|
||||
__visible const sys_call_ptr_t ia32_sys_call_table[__NR_syscall_compat_max+1] = {
|
||||
/*
|
||||
* Smells like a compiler bug -- it doesn't work
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/syscall.h>
|
||||
|
||||
#define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
/* this is a lie, but it does not hurt as sys_ni_syscall just returns -EINVAL */
|
||||
extern asmlinkage long sys_ni_syscall(const struct pt_regs *);
|
||||
#define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *);
|
||||
#include <asm/syscalls_64.h>
|
||||
#undef __SYSCALL_64
|
||||
|
||||
#define __SYSCALL_64(nr, sym, qual) [nr] = sym,
|
||||
|
||||
extern long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
|
||||
asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
|
||||
/*
|
||||
* Smells like a compiler bug -- it doesn't work
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -25,15 +25,27 @@ emit() {
|
||||
nr="$2"
|
||||
entry="$3"
|
||||
compat="$4"
|
||||
umlentry=""
|
||||
|
||||
if [ "$abi" = "64" -a -n "$compat" ]; then
|
||||
echo "a compat entry for a 64-bit syscall makes no sense" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For CONFIG_UML, we need to strip the __x64_sys prefix
|
||||
if [ "$abi" = "64" -a "${entry}" != "${entry#__x64_sys}" ]; then
|
||||
umlentry="sys${entry#__x64_sys}"
|
||||
fi
|
||||
|
||||
if [ -z "$compat" ]; then
|
||||
if [ -n "$entry" ]; then
|
||||
if [ -n "$entry" -a -z "$umlentry" ]; then
|
||||
syscall_macro "$abi" "$nr" "$entry"
|
||||
elif [ -n "$umlentry" ]; then # implies -n "$entry"
|
||||
echo "#ifdef CONFIG_X86"
|
||||
syscall_macro "$abi" "$nr" "$entry"
|
||||
echo "#else /* CONFIG_UML */"
|
||||
syscall_macro "$abi" "$nr" "$umlentry"
|
||||
echo "#endif"
|
||||
fi
|
||||
else
|
||||
echo "#ifdef CONFIG_X86_32"
|
||||
|
||||
@@ -127,6 +127,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
|
||||
int vsyscall_nr, syscall_nr, tmp;
|
||||
int prev_sig_on_uaccess_err;
|
||||
long ret;
|
||||
unsigned long orig_dx;
|
||||
|
||||
/*
|
||||
* No point in checking CS -- the only way to get here is a user mode
|
||||
@@ -227,19 +228,22 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
|
||||
ret = -EFAULT;
|
||||
switch (vsyscall_nr) {
|
||||
case 0:
|
||||
ret = sys_gettimeofday(
|
||||
(struct timeval __user *)regs->di,
|
||||
(struct timezone __user *)regs->si);
|
||||
/* this decodes regs->di and regs->si on its own */
|
||||
ret = __x64_sys_gettimeofday(regs);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ret = sys_time((time_t __user *)regs->di);
|
||||
/* this decodes regs->di on its own */
|
||||
ret = __x64_sys_time(regs);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ret = sys_getcpu((unsigned __user *)regs->di,
|
||||
(unsigned __user *)regs->si,
|
||||
NULL);
|
||||
/* while we could clobber regs->dx, we didn't in the past... */
|
||||
orig_dx = regs->dx;
|
||||
regs->dx = 0;
|
||||
/* this decodes regs->di, regs->si and regs->dx on its own */
|
||||
ret = __x64_sys_getcpu(regs);
|
||||
regs->dx = orig_dx;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ struct apic {
|
||||
/* Probe, setup and smpboot functions */
|
||||
int (*probe)(void);
|
||||
int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
|
||||
int (*apic_id_valid)(int apicid);
|
||||
int (*apic_id_valid)(u32 apicid);
|
||||
int (*apic_id_registered)(void);
|
||||
|
||||
bool (*check_apicid_used)(physid_mask_t *map, int apicid);
|
||||
@@ -486,7 +486,7 @@ static inline unsigned int read_apic_id(void)
|
||||
return apic->get_apic_id(reg);
|
||||
}
|
||||
|
||||
extern int default_apic_id_valid(int apicid);
|
||||
extern int default_apic_id_valid(u32 apicid);
|
||||
extern int default_acpi_madt_oem_check(char *, char *);
|
||||
extern void default_setup_apic_routing(void);
|
||||
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
#include <asm/thread_info.h> /* for TS_COMPAT */
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
typedef asmlinkage long (*sys_call_ptr_t)(const struct pt_regs *);
|
||||
#else
|
||||
typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
|
||||
unsigned long, unsigned long,
|
||||
unsigned long, unsigned long);
|
||||
#endif /* CONFIG_X86_64 */
|
||||
extern const sys_call_ptr_t sys_call_table[];
|
||||
|
||||
#if defined(CONFIG_X86_32)
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* syscall_wrapper.h - x86 specific wrappers to syscall definitions
|
||||
*/
|
||||
|
||||
#ifndef _ASM_X86_SYSCALL_WRAPPER_H
|
||||
#define _ASM_X86_SYSCALL_WRAPPER_H
|
||||
|
||||
/* Mapping of registers to parameters for syscalls on x86-64 and x32 */
|
||||
#define SC_X86_64_REGS_TO_ARGS(x, ...) \
|
||||
__MAP(x,__SC_ARGS \
|
||||
,,regs->di,,regs->si,,regs->dx \
|
||||
,,regs->r10,,regs->r8,,regs->r9) \
|
||||
|
||||
/* Mapping of registers to parameters for syscalls on i386 */
|
||||
#define SC_IA32_REGS_TO_ARGS(x, ...) \
|
||||
__MAP(x,__SC_ARGS \
|
||||
,,(unsigned int)regs->bx,,(unsigned int)regs->cx \
|
||||
,,(unsigned int)regs->dx,,(unsigned int)regs->si \
|
||||
,,(unsigned int)regs->di,,(unsigned int)regs->bp)
|
||||
|
||||
#ifdef CONFIG_IA32_EMULATION
|
||||
/*
|
||||
* For IA32 emulation, we need to handle "compat" syscalls *and* create
|
||||
* additional wrappers (aptly named __ia32_sys_xyzzy) which decode the
|
||||
* ia32 regs in the proper order for shared or "common" syscalls. As some
|
||||
* syscalls may not be implemented, we need to expand COND_SYSCALL in
|
||||
* kernel/sys_ni.c and SYS_NI in kernel/time/posix-stubs.c to cover this
|
||||
* case as well.
|
||||
*/
|
||||
#define __IA32_COMPAT_SYS_STUBx(x, name, ...) \
|
||||
asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs);\
|
||||
ALLOW_ERROR_INJECTION(__ia32_compat_sys##name, ERRNO); \
|
||||
asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs)\
|
||||
{ \
|
||||
return __se_compat_sys##name(SC_IA32_REGS_TO_ARGS(x,__VA_ARGS__));\
|
||||
} \
|
||||
|
||||
#define __IA32_SYS_STUBx(x, name, ...) \
|
||||
asmlinkage long __ia32_sys##name(const struct pt_regs *regs); \
|
||||
ALLOW_ERROR_INJECTION(__ia32_sys##name, ERRNO); \
|
||||
asmlinkage long __ia32_sys##name(const struct pt_regs *regs) \
|
||||
{ \
|
||||
return __se_sys##name(SC_IA32_REGS_TO_ARGS(x,__VA_ARGS__));\
|
||||
}
|
||||
|
||||
/*
|
||||
* To keep the naming coherent, re-define SYSCALL_DEFINE0 to create an alias
|
||||
* named __ia32_sys_*()
|
||||
*/
|
||||
#define SYSCALL_DEFINE0(sname) \
|
||||
SYSCALL_METADATA(_##sname, 0); \
|
||||
asmlinkage long __x64_sys_##sname(void); \
|
||||
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
|
||||
SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \
|
||||
asmlinkage long __x64_sys_##sname(void)
|
||||
|
||||
#define COND_SYSCALL(name) \
|
||||
cond_syscall(__x64_sys_##name); \
|
||||
cond_syscall(__ia32_sys_##name)
|
||||
|
||||
#define SYS_NI(name) \
|
||||
SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers); \
|
||||
SYSCALL_ALIAS(__ia32_sys_##name, sys_ni_posix_timers)
|
||||
|
||||
#else /* CONFIG_IA32_EMULATION */
|
||||
#define __IA32_COMPAT_SYS_STUBx(x, name, ...)
|
||||
#define __IA32_SYS_STUBx(x, fullname, name, ...)
|
||||
#endif /* CONFIG_IA32_EMULATION */
|
||||
|
||||
|
||||
#ifdef CONFIG_X86_X32
|
||||
/*
|
||||
* For the x32 ABI, we need to create a stub for compat_sys_*() which is aware
|
||||
* of the x86-64-style parameter ordering of x32 syscalls. The syscalls common
|
||||
* with x86_64 obviously do not need such care.
|
||||
*/
|
||||
#define __X32_COMPAT_SYS_STUBx(x, name, ...) \
|
||||
asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
|
||||
ALLOW_ERROR_INJECTION(__x32_compat_sys##name, ERRNO); \
|
||||
asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
|
||||
{ \
|
||||
return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
|
||||
} \
|
||||
|
||||
#else /* CONFIG_X86_X32 */
|
||||
#define __X32_COMPAT_SYS_STUBx(x, name, ...)
|
||||
#endif /* CONFIG_X86_X32 */
|
||||
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
/*
|
||||
* Compat means IA32_EMULATION and/or X86_X32. As they use a different
|
||||
* mapping of registers to parameters, we need to generate stubs for each
|
||||
* of them.
|
||||
*/
|
||||
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
|
||||
static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
|
||||
static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
|
||||
__IA32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__) \
|
||||
__X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__) \
|
||||
static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
|
||||
{ \
|
||||
return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
|
||||
} \
|
||||
static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
|
||||
|
||||
/*
|
||||
* As some compat syscalls may not be implemented, we need to expand
|
||||
* COND_SYSCALL_COMPAT in kernel/sys_ni.c and COMPAT_SYS_NI in
|
||||
* kernel/time/posix-stubs.c to cover this case as well.
|
||||
*/
|
||||
#define COND_SYSCALL_COMPAT(name) \
|
||||
cond_syscall(__ia32_compat_sys_##name); \
|
||||
cond_syscall(__x32_compat_sys_##name)
|
||||
|
||||
#define COMPAT_SYS_NI(name) \
|
||||
SYSCALL_ALIAS(__ia32_compat_sys_##name, sys_ni_posix_timers); \
|
||||
SYSCALL_ALIAS(__x32_compat_sys_##name, sys_ni_posix_timers)
|
||||
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
|
||||
/*
|
||||
* Instead of the generic __SYSCALL_DEFINEx() definition, this macro takes
|
||||
* struct pt_regs *regs as the only argument of the syscall stub named
|
||||
* __x64_sys_*(). It decodes just the registers it needs and passes them on to
|
||||
* the __se_sys_*() wrapper performing sign extension and then to the
|
||||
* __do_sys_*() function doing the actual job. These wrappers and functions
|
||||
* are inlined (at least in very most cases), meaning that the assembly looks
|
||||
* as follows (slightly re-ordered for better readability):
|
||||
*
|
||||
* <__x64_sys_recv>: <-- syscall with 4 parameters
|
||||
* callq <__fentry__>
|
||||
*
|
||||
* mov 0x70(%rdi),%rdi <-- decode regs->di
|
||||
* mov 0x68(%rdi),%rsi <-- decode regs->si
|
||||
* mov 0x60(%rdi),%rdx <-- decode regs->dx
|
||||
* mov 0x38(%rdi),%rcx <-- decode regs->r10
|
||||
*
|
||||
* xor %r9d,%r9d <-- clear %r9
|
||||
* xor %r8d,%r8d <-- clear %r8
|
||||
*
|
||||
* callq __sys_recvfrom <-- do the actual work in __sys_recvfrom()
|
||||
* which takes 6 arguments
|
||||
*
|
||||
* cltq <-- extend return value to 64-bit
|
||||
* retq <-- return
|
||||
*
|
||||
* This approach avoids leaking random user-provided register content down
|
||||
* the call chain.
|
||||
*
|
||||
* If IA32_EMULATION is enabled, this macro generates an additional wrapper
|
||||
* named __ia32_sys_*() which decodes the struct pt_regs *regs according
|
||||
* to the i386 calling convention (bx, cx, dx, si, di, bp).
|
||||
*/
|
||||
#define __SYSCALL_DEFINEx(x, name, ...) \
|
||||
asmlinkage long __x64_sys##name(const struct pt_regs *regs); \
|
||||
ALLOW_ERROR_INJECTION(__x64_sys##name, ERRNO); \
|
||||
static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
|
||||
static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
|
||||
asmlinkage long __x64_sys##name(const struct pt_regs *regs) \
|
||||
{ \
|
||||
return __se_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
|
||||
} \
|
||||
__IA32_SYS_STUBx(x, name, __VA_ARGS__) \
|
||||
static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
|
||||
{ \
|
||||
long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
|
||||
__MAP(x,__SC_TEST,__VA_ARGS__); \
|
||||
__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
|
||||
return ret; \
|
||||
} \
|
||||
static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
|
||||
|
||||
/*
|
||||
* As the generic SYSCALL_DEFINE0() macro does not decode any parameters for
|
||||
* obvious reasons, and passing struct pt_regs *regs to it in %rdi does not
|
||||
* hurt, we only need to re-define it here to keep the naming congruent to
|
||||
* SYSCALL_DEFINEx() -- which is essential for the COND_SYSCALL() and SYS_NI()
|
||||
* macros to work correctly.
|
||||
*/
|
||||
#ifndef SYSCALL_DEFINE0
|
||||
#define SYSCALL_DEFINE0(sname) \
|
||||
SYSCALL_METADATA(_##sname, 0); \
|
||||
asmlinkage long __x64_sys_##sname(void); \
|
||||
ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \
|
||||
asmlinkage long __x64_sys_##sname(void)
|
||||
#endif
|
||||
|
||||
#ifndef COND_SYSCALL
|
||||
#define COND_SYSCALL(name) cond_syscall(__x64_sys_##name)
|
||||
#endif
|
||||
|
||||
#ifndef SYS_NI
|
||||
#define SYS_NI(name) SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* For VSYSCALLS, we need to declare these three syscalls with the new
|
||||
* pt_regs-based calling convention for in-kernel use.
|
||||
*/
|
||||
struct pt_regs;
|
||||
asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs);
|
||||
asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs);
|
||||
asmlinkage long __x64_sys_time(const struct pt_regs *regs);
|
||||
|
||||
#endif /* _ASM_X86_SYSCALL_WRAPPER_H */
|
||||
@@ -18,6 +18,12 @@
|
||||
/* Common in X86_32 and X86_64 */
|
||||
/* kernel/ioport.c */
|
||||
long ksys_ioperm(unsigned long from, unsigned long num, int turn_on);
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
/*
|
||||
* These definitions are only valid on pure 32-bit systems; x86-64 uses a
|
||||
* different syscall calling convention
|
||||
*/
|
||||
asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
|
||||
asmlinkage long sys_iopl(unsigned int);
|
||||
|
||||
@@ -32,7 +38,6 @@ asmlinkage long sys_set_thread_area(struct user_desc __user *);
|
||||
asmlinkage long sys_get_thread_area(struct user_desc __user *);
|
||||
|
||||
/* X86_32 only */
|
||||
#ifdef CONFIG_X86_32
|
||||
|
||||
/* kernel/signal.c */
|
||||
asmlinkage long sys_sigreturn(void);
|
||||
@@ -42,15 +47,5 @@ struct vm86_struct;
|
||||
asmlinkage long sys_vm86old(struct vm86_struct __user *);
|
||||
asmlinkage long sys_vm86(unsigned long, unsigned long);
|
||||
|
||||
#else /* CONFIG_X86_32 */
|
||||
|
||||
/* X86_64 only */
|
||||
/* kernel/process_64.c */
|
||||
asmlinkage long sys_arch_prctl(int, unsigned long);
|
||||
|
||||
/* kernel/sys_x86_64.c */
|
||||
asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long,
|
||||
unsigned long, unsigned long, unsigned long);
|
||||
|
||||
#endif /* CONFIG_X86_32 */
|
||||
#endif /* _ASM_X86_SYSCALLS_H */
|
||||
|
||||
@@ -200,7 +200,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
|
||||
{
|
||||
struct acpi_madt_local_x2apic *processor = NULL;
|
||||
#ifdef CONFIG_X86_X2APIC
|
||||
int apic_id;
|
||||
u32 apic_id;
|
||||
u8 enabled;
|
||||
#endif
|
||||
|
||||
@@ -222,10 +222,13 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
|
||||
* to not preallocating memory for all NR_CPUS
|
||||
* when we use CPU hotplug.
|
||||
*/
|
||||
if (!apic->apic_id_valid(apic_id) && enabled)
|
||||
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
|
||||
else
|
||||
acpi_register_lapic(apic_id, processor->uid, enabled);
|
||||
if (!apic->apic_id_valid(apic_id)) {
|
||||
if (enabled)
|
||||
pr_warn(PREFIX "x2apic entry ignored\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
acpi_register_lapic(apic_id, processor->uid, enabled);
|
||||
#else
|
||||
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@ int default_check_phys_apicid_present(int phys_apicid)
|
||||
return physid_isset(phys_apicid, phys_cpu_present_map);
|
||||
}
|
||||
|
||||
int default_apic_id_valid(int apicid)
|
||||
int default_apic_id_valid(u32 apicid)
|
||||
{
|
||||
return (apicid < 255);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ static u32 numachip2_set_apic_id(unsigned int id)
|
||||
return id << 24;
|
||||
}
|
||||
|
||||
static int numachip_apic_id_valid(int apicid)
|
||||
static int numachip_apic_id_valid(u32 apicid)
|
||||
{
|
||||
/* Trust what bootloader passes in MADT */
|
||||
return 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user