[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110302162650.GA26810@redhat.com>
Date: Wed, 2 Mar 2011 17:26:50 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>, pageexec@...email.hu,
Solar Designer <solar@...nwall.com>,
Eugene Teo <eteo@...hat.com>,
Brad Spengler <spender@...ecurity.net>,
Roland McGrath <roland@...hat.com>,
Milton Miller <miltonm@....com>
Subject: [PATCH v3 0/4] exec: unify native/compat code
On 03/01, Linus Torvalds wrote:
>
> So I'm ok with your alternative
>
> > typedef union {
> > const char __user *const __user *native;
> > compat_uptr_t __user *compat;
> > } conditional_user_ptr_t;
>
> model instead, which moves the pointer into the union.
>
> However, if you do this, then I have one more suggestion: just move
> the "compat" flag in there too!
>
> Every time you pass the union, you're going to pass the compat flag to
> distinguish the cases. So do it like this:
>
> struct conditional_ptr {
> int is_compat;
> union {
> const char __user *const __user *native;
> compat_uptr_t __user *compat;
> };
> };
>
> and it will all look much cleaner, I bet.
Heh. I knew. I swear, I knew you would suggest this ;)
OK, please find v3. I had to deanonymize the union though, otherwise
the initializer in do_execve() becomes nontrivial.
But I don't think this is right. Not only this adds 200 bytes to exec.o.
To me, is_compat is not the private property of argv/envp. Yes, currently
nobody except get_arg_ptr() needs to know the difference. But who knows,
it is possible that we will need more "if (compat)" code in future. IOW,
I think that the explicit argument is a win.
Never mind. I agree with everything as long as we can remove this c-a-p
compat_do_execve().
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists