Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14065
b: refs/heads/master
c: 7a59061
h: refs/heads/master
i:
  14063: 8baa3eb
v: v3
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Nov 14, 2005
1 parent 620b787 commit 3a92b1b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 55c033c1f6cdedc350c79c3198b542e3ab496899
refs/heads/master: 7a590611c0f1e1302c58fdfdc958f2d6bdddd78a
19 changes: 18 additions & 1 deletion trunk/arch/um/include/um_uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,25 @@
#include "uaccess-skas.h"
#endif

#define __under_task_size(addr, size) \
(((unsigned long) (addr) < TASK_SIZE) && \
(((unsigned long) (addr) + (size)) < TASK_SIZE))

#define __access_ok_vsyscall(type, addr, size) \
((type == VERIFY_READ) && \
((unsigned long) (addr) >= FIXADDR_USER_START) && \
((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
((unsigned long) (addr) + (size) >= (unsigned long)(addr)))

#define __addr_range_nowrap(addr, size) \
((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))

#define access_ok(type, addr, size) \
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)
(__addr_range_nowrap(addr, size) && \
(__under_task_size(addr, size) || \
__access_ok_vsyscall(type, addr, size) || \
segment_eq(get_fs(), KERNEL_DS) || \
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))

static inline int copy_from_user(void *to, const void __user *from, int n)
{
Expand Down
10 changes: 2 additions & 8 deletions trunk/arch/um/kernel/skas/include/uaccess-skas.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
#include "asm/errno.h"
#include "asm/fixmap.h"

#define access_ok_skas(type, addr, size) \
((segment_eq(get_fs(), KERNEL_DS)) || \
(((unsigned long) (addr) < TASK_SIZE) && \
((unsigned long) (addr) + (size) <= TASK_SIZE)) || \
((type == VERIFY_READ ) && \
((unsigned long) (addr) >= FIXADDR_USER_START) && \
((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
/* No SKAS-specific checking. */
#define access_ok_skas(type, addr, size) 0

extern int copy_from_user_skas(void *to, const void __user *from, int n);
extern int copy_to_user_skas(void __user *to, const void *from, int n);
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/um/kernel/skas/uaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ int copy_from_user_skas(void *to, const void __user *from, int n)
return(0);
}

return(access_ok_skas(VERIFY_READ, from, n) ?
return(access_ok(VERIFY_READ, from, n) ?
buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
n);
}
Expand All @@ -164,7 +164,7 @@ int copy_to_user_skas(void __user *to, const void *from, int n)
return(0);
}

return(access_ok_skas(VERIFY_WRITE, to, n) ?
return(access_ok(VERIFY_WRITE, to, n) ?
buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
n);
}
Expand Down Expand Up @@ -193,7 +193,7 @@ int strncpy_from_user_skas(char *dst, const char __user *src, int count)
return(strnlen(dst, count));
}

if(!access_ok_skas(VERIFY_READ, src, 1))
if(!access_ok(VERIFY_READ, src, 1))
return(-EFAULT);

n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
Expand Down Expand Up @@ -221,7 +221,7 @@ int clear_user_skas(void __user *mem, int len)
return(0);
}

return(access_ok_skas(VERIFY_WRITE, mem, len) ?
return(access_ok(VERIFY_WRITE, mem, len) ?
buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len);
}

Expand Down
8 changes: 1 addition & 7 deletions trunk/arch/um/kernel/tt/include/uaccess-tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@
extern unsigned long end_vm;
extern unsigned long uml_physmem;

#define under_task_size(addr, size) \
(((unsigned long) (addr) < TASK_SIZE) && \
(((unsigned long) (addr) + (size)) < TASK_SIZE))

#define is_stack(addr, size) \
(((unsigned long) (addr) < STACK_TOP) && \
((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \
(((unsigned long) (addr) + (size)) <= STACK_TOP))

#define access_ok_tt(type, addr, size) \
((type == VERIFY_READ) || (segment_eq(get_fs(), KERNEL_DS)) || \
(((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
(under_task_size(addr, size) || is_stack(addr, size))))
(is_stack(addr, size))

extern unsigned long get_fault_addr(void);

Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/um/kernel/tt/uaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

int copy_from_user_tt(void *to, const void __user *from, int n)
{
if(!access_ok_tt(VERIFY_READ, from, n))
if(!access_ok(VERIFY_READ, from, n))
return(n);

return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
Expand All @@ -17,7 +17,7 @@ int copy_from_user_tt(void *to, const void __user *from, int n)

int copy_to_user_tt(void __user *to, const void *from, int n)
{
if(!access_ok_tt(VERIFY_WRITE, to, n))
if(!access_ok(VERIFY_WRITE, to, n))
return(n);

return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
Expand All @@ -28,7 +28,7 @@ int strncpy_from_user_tt(char *dst, const char __user *src, int count)
{
int n;

if(!access_ok_tt(VERIFY_READ, src, 1))
if(!access_ok(VERIFY_READ, src, 1))
return(-EFAULT);

n = __do_strncpy_from_user(dst, src, count,
Expand All @@ -47,7 +47,7 @@ int __clear_user_tt(void __user *mem, int len)

int clear_user_tt(void __user *mem, int len)
{
if(!access_ok_tt(VERIFY_WRITE, mem, len))
if(!access_ok(VERIFY_WRITE, mem, len))
return(len);

return(__do_clear_user(mem, len, &current->thread.fault_addr,
Expand Down

0 comments on commit 3a92b1b

Please sign in to comment.