Re: gcc 3.3.4/3.4.1 and get_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> On Mon, 20 Sep 2004 19:10:21 +0200, Ralf Baechle <ralf@xxxxxxxxxxxxxx> said:
ralf> And here the same for 2.4.  Actually this is a straight backport
ralf> of the 2.6 uaccess.h to 2.4 so with this patch
ralf> include/asm-mips/uaccess.h and include/asm-mips64/uaccess.h are
ralf> going to be identical.

This also fixes long standing bug in 2.4 mips64 __ua_size macro.  Thank you.

There is still an another problem in 64-bit __access_ok (both 2.4 and
2.6).

The __access_ok for 64-bit kernel returns 0 if 'addr' + 'size' ==
TASK_SIZE (which should be OK).

#define __access_ok(addr, size, mask)					\
	(((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)

I think this should be:

#define __access_ok(addr, size, mask)					\
	(((signed long)((mask) & ((addr) | ((addr) + (size) - 1) | __ua_size(size)))) == 0)

This fix is needed for 64-bit native mount syscall (which try to read
variable length string parameters from user stack.  See
fs/namespace.c:copy_mount_options).

This fix also makes __access_ok(0, 0, __access_mask) return 0, but
pointer 0 is invalid anyway.

---
Atsushi Nemoto


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux