Messages in this thread | | | Date | Wed, 2 Mar 2011 17:26:50 +0100 | From | Oleg Nesterov <> | 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |