Re: [uml-devel] Re: [patch 1/1] uml: fix lvalue for gcc4

From: Blaisorblade
Date: Mon Jul 11 2005 - 17:20:12 EST


On Saturday 09 July 2005 13:07, Russell King wrote:
> On Sat, Jul 09, 2005 at 01:01:33PM +0200, blaisorblade@xxxxxxxx wrote:
> > diff -puN arch/um/sys-x86_64/signal.c~uml-fix-for-gcc4-lvalue
> > arch/um/sys-x86_64/signal.c ---
> > linux-2.6.git/arch/um/sys-x86_64/signal.c~uml-fix-for-gcc4-lvalue 2005-07
> >-09 13:01:03.000000000 +0200 +++
> > linux-2.6.git-paolo/arch/um/sys-x86_64/signal.c 2005-07-09
> > 13:01:03.000000000 +0200 @@ -168,7 +168,7 @@ int
> > setup_signal_stack_si(unsigned long
> >
> > frame = (struct rt_sigframe __user *)
> > round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
> > - ((unsigned char *) frame) -= 128;
> > + frame -= 128 / sizeof(frame);
>
> Are you sure these two are identical?
SOOOOOOOOORRY, I've become crazy, I meant sizeof(*frame)... thanks for
noticing.

> The above code fragment looks suspicious anyway, particularly:
>
> frame = (struct rt_sigframe __user *)
> round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
>
> which will put the frame at 8 * sizeof(struct rt_sigframe) below
> the point which round_down() would return (which would be 1 struct
> rt_sigframe below stack_top, rounded down).

You're completely right.

The code is copied from arch/x86_64/kernel/signal.c:setup_rt_frame(), so it
should make some sense; but in the source, the cast is to (void*).

Surely Jeff, seeing that the result is assigned to a struct rt_sigframe
__user, "fixed" it. The line I'm patching is new from Jeff, and I don't know
what's about (I just remember that

Also, the below access_ok() called on fp (which is still NULL) is surely
completely wrong, though it won't fail (after all, NULL is under TASK_SIZE.
right?).

On x86_64 the code is always used from arch/um/kernel/signal_kern.c, since
CONFIG_whatever is not enabled.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade






___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/