linux-mips
[Top] [All Lists]

Re: gcc 3.3.4/3.4.1 and get_user

To: ralf@linux-mips.org
Subject: Re: gcc 3.3.4/3.4.1 and get_user
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 24 Sep 2004 16:39:23 +0900 (JST)
Cc: linux-mips@linux-mips.org
In-reply-to: <20040920171021.GA25371@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <87656yqsmz.fsf@redhat.com> <20040920154042.GB5150@linux-mips.org> <20040920171021.GA25371@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
>>>>> On Mon, 20 Sep 2004 19:10:21 +0200, Ralf Baechle <ralf@linux-mips.org> 
>>>>> 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

<Prev in Thread] Current Thread [Next in Thread>