diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 16:54:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 16:54:09 -0500 |
commit | 3e6bdf473f489664dac4d7511d26c7ac3dfdc748 (patch) | |
tree | 10cb2e928830b9de8bbc3f6dd47c18c24cd2affa /arch/x86/kernel/ptrace.c | |
parent | 3d4d4582e5b3f67a68f2cf32fd5b70d8d80f119d (diff) | |
parent | 58d5d0d8dd52cbca988af24b5692a20b00285543 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86:
x86: fix deadlock, make pgd_lock irq-safe
virtio: fix trivial build bug
x86: fix mttr trimming
x86: delay CPA self-test and repeat it
x86: fix 64-bit sections
generic: add __FINITDATA
x86: remove suprious ifdefs from pageattr.c
x86: mark the .rodata section also NX
x86: fix iret exception recovery on 64-bit
cpuidle: dubious one-bit signed bitfield in cpuidle.h
x86: fix sparse warnings in powernow-k8.c
x86: fix sparse error in traps_32.c
x86: trivial sparse/checkpatch in quirks.c
x86 ptrace: disallow null cs/ss
MAINTAINERS: RDC R-321x SoC maintainer
brk randomization: introduce CONFIG_COMPAT_BRK
brk: check the lower bound properly
x86: remove X2 workaround
x86: make spurious fault handler aware of large mappings
x86: make traps on entry code be debuggable in user space, 64-bit
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 96286df1bb81..702c33efea84 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -103,9 +103,26 @@ static int set_segment_reg(struct task_struct *task, | |||
103 | if (invalid_selector(value)) | 103 | if (invalid_selector(value)) |
104 | return -EIO; | 104 | return -EIO; |
105 | 105 | ||
106 | if (offset != offsetof(struct user_regs_struct, gs)) | 106 | /* |
107 | * For %cs and %ss we cannot permit a null selector. | ||
108 | * We can permit a bogus selector as long as it has USER_RPL. | ||
109 | * Null selectors are fine for other segment registers, but | ||
110 | * we will never get back to user mode with invalid %cs or %ss | ||
111 | * and will take the trap in iret instead. Much code relies | ||
112 | * on user_mode() to distinguish a user trap frame (which can | ||
113 | * safely use invalid selectors) from a kernel trap frame. | ||
114 | */ | ||
115 | switch (offset) { | ||
116 | case offsetof(struct user_regs_struct, cs): | ||
117 | case offsetof(struct user_regs_struct, ss): | ||
118 | if (unlikely(value == 0)) | ||
119 | return -EIO; | ||
120 | |||
121 | default: | ||
107 | *pt_regs_access(task_pt_regs(task), offset) = value; | 122 | *pt_regs_access(task_pt_regs(task), offset) = value; |
108 | else { | 123 | break; |
124 | |||
125 | case offsetof(struct user_regs_struct, gs): | ||
109 | task->thread.gs = value; | 126 | task->thread.gs = value; |
110 | if (task == current) | 127 | if (task == current) |
111 | /* | 128 | /* |
@@ -227,12 +244,16 @@ static int set_segment_reg(struct task_struct *task, | |||
227 | * Can't actually change these in 64-bit mode. | 244 | * Can't actually change these in 64-bit mode. |
228 | */ | 245 | */ |
229 | case offsetof(struct user_regs_struct,cs): | 246 | case offsetof(struct user_regs_struct,cs): |
247 | if (unlikely(value == 0)) | ||
248 | return -EIO; | ||
230 | #ifdef CONFIG_IA32_EMULATION | 249 | #ifdef CONFIG_IA32_EMULATION |
231 | if (test_tsk_thread_flag(task, TIF_IA32)) | 250 | if (test_tsk_thread_flag(task, TIF_IA32)) |
232 | task_pt_regs(task)->cs = value; | 251 | task_pt_regs(task)->cs = value; |
233 | #endif | 252 | #endif |
234 | break; | 253 | break; |
235 | case offsetof(struct user_regs_struct,ss): | 254 | case offsetof(struct user_regs_struct,ss): |
255 | if (unlikely(value == 0)) | ||
256 | return -EIO; | ||
236 | #ifdef CONFIG_IA32_EMULATION | 257 | #ifdef CONFIG_IA32_EMULATION |
237 | if (test_tsk_thread_flag(task, TIF_IA32)) | 258 | if (test_tsk_thread_flag(task, TIF_IA32)) |
238 | task_pt_regs(task)->ss = value; | 259 | task_pt_regs(task)->ss = value; |