[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTikVecxcGoZ9a4hmkoi4wynrNfH9_AU7Vb+hOvbH@mail.gmail.com>
Date: Tue, 1 Mar 2011 13:39:35 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
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: Re: [PATCH v2 0/5] exec: unify native/compat code
On Tue, Mar 1, 2011 at 12:47 PM, Oleg Nesterov <oleg@...hat.com> wrote:
> where that 'do_execve_common()' takes it's arguments as
>
> union conditional_user_ptr_t __user *argv,
> union conditional_user_ptr_t __user *envp
>
> I hope you didn't really mean this...
I really did mean that (although not the double "union" + "_t" thing
for the typedef).
But I'm not going to claim that it has to be done exactly that way,
the union can certainly be encapsulated differently too.
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.
Linus
--
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