[RFC PATCH 1/2] ARM: use generic strnlen_user and strncpy_from_user functions
u.kleine-koenig at pengutronix.de
Thu Oct 4 05:40:15 EDT 2012
On Wed, Oct 03, 2012 at 10:16:36AM +0100, Will Deacon wrote:
> On Wed, Oct 03, 2012 at 07:00:42AM +0100, Uwe Kleine-König wrote:
> > On Tue, Oct 02, 2012 at 08:18:51PM +0100, Will Deacon wrote:
> > > Ok, thanks for the heads-up. I didn't test it with an M-class CPU, but
> > > hopefully that's understandable :)
> > I think so, yes. But I intend to change that, and I heard your coworker
> > gets an efm32 :-)
> Yep, he'll be in charge of testing for us (!)
> > > > > +#define user_addr_max() \
> > > > > + (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
> > > > > +
> > > > I think this is the problem as for no-mmu USER_DS == KERNEL_DS. I will
> > > > take a look tomorrow.
> > >
> > > I can't immediately see why that would cause a problem, so please let me
> > > know if you get more information.
> > BTW, I once saw the call to sys_mount fail:
> > sys_mount ->
> > copy_mount_string ->
> > strndup_user ->
> > strnlen_user returns 0 which makes sys_mount fail with -EFAULT.
> > but that was not the problem I hit when I bisected (using merges instead
> > of rebasing).
> Was this also on your M3?
Yeah. I found a change that fixes it for me:
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 77bd79f..7775e03 100644
@@ -216,7 +216,7 @@ static inline void set_fs(mm_segment_t fs)
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
#define user_addr_max() \
- (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
+ (segment_eq(get_fs(), KERNEL_DL) ? ~0UL : TASK_SIZE)
* The "__xxx" versions of the user access functions do not verify the
I'm not sure if this has some security implications for the !MMU case!?
(But if so according to my understanding (which might well be wrong)
using TASK_SIZE isn't correct also. So this only widens the window, but
doesn't create it.)
On !MMU TASK_SIZE is CONFIG_DRAM_SIZE, but I'm using XIP and the flash
is at an higher address than RAM. So maybe XIP is broken on MMU
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-arm-kernel