aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/tt/include
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-11-13 19:07:13 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-13 21:14:15 -0500
commit7a590611c0f1e1302c58fdfdc958f2d6bdddd78a (patch)
treead57f5bda5245af1d03ba10e15308487b1aae9c7 /arch/um/kernel/tt/include
parent55c033c1f6cdedc350c79c3198b542e3ab496899 (diff)
[PATCH] uml: fix access_ok
The access_ok_tt() macro is bogus, in that a read access is unconditionally considered valid. I couldn't find in SCM logs the introduction of this check, but I went back to 2.4.20-1um and the definition was the same. Possibly this was done to avoid problems with missing set_fs() calls, but there can't be any I think because they would fail with SKAS mode. TT-specific code is still to check. Also, this patch joins common code together, and makes the "address range wrapping" check happen for all cases, rather than for only some. This may, possibly, be reoptimized at some time, but the current code doesn't seem clever, just confused. * Important: I've also had to change references to access_ok_{tt,skas} back to access_ok - the kernel wasn't that happy otherwise. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/tt/include')
-rw-r--r--arch/um/kernel/tt/include/uaccess-tt.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h
index dc2ebfa8c54f..b9bfe9c481c4 100644
--- a/arch/um/kernel/tt/include/uaccess-tt.h
+++ b/arch/um/kernel/tt/include/uaccess-tt.h
@@ -19,19 +19,13 @@
19extern unsigned long end_vm; 19extern unsigned long end_vm;
20extern unsigned long uml_physmem; 20extern unsigned long uml_physmem;
21 21
22#define under_task_size(addr, size) \
23 (((unsigned long) (addr) < TASK_SIZE) && \
24 (((unsigned long) (addr) + (size)) < TASK_SIZE))
25
26#define is_stack(addr, size) \ 22#define is_stack(addr, size) \
27 (((unsigned long) (addr) < STACK_TOP) && \ 23 (((unsigned long) (addr) < STACK_TOP) && \
28 ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \ 24 ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \
29 (((unsigned long) (addr) + (size)) <= STACK_TOP)) 25 (((unsigned long) (addr) + (size)) <= STACK_TOP))
30 26
31#define access_ok_tt(type, addr, size) \ 27#define access_ok_tt(type, addr, size) \
32 ((type == VERIFY_READ) || (segment_eq(get_fs(), KERNEL_DS)) || \ 28 (is_stack(addr, size))
33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
34 (under_task_size(addr, size) || is_stack(addr, size))))
35 29
36extern unsigned long get_fault_addr(void); 30extern unsigned long get_fault_addr(void);
37 31