[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ddbaba35-9cc5-dfb9-3cae-51b026de5b65@c-s.fr>
Date: Tue, 28 Apr 2020 09:45:46 +0200
From: Christophe Leroy <christophe.leroy@....fr>
To: Christoph Hellwig <hch@....de>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>,
Jeremy Kerr <jk@...abs.org>, linux-fsdevel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
"Eric W . Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH 2/7] signal: factor copy_siginfo_to_external32 from
copy_siginfo_to_user32
Le 28/04/2020 à 09:09, Christoph Hellwig a écrit :
> On Mon, Apr 27, 2020 at 03:40:50PM -0700, Andrew Morton wrote:
>>> https://www.spinics.net/lists/kernel/msg3473847.html
>>> https://www.spinics.net/lists/kernel/msg3473840.html
>>> https://www.spinics.net/lists/kernel/msg3473843.html
>>
>> OK, but that doesn't necessitate the above monstrosity? How about
>>
>> static int __copy_siginfo_to_user32(struct compat_siginfo __user *to,
>> const struct kernel_siginfo *from, bool x32_ABI)
>> {
>> struct compat_siginfo new;
>> copy_siginfo_to_external32(&new, from);
>> ...
>> }
>>
>> int copy_siginfo_to_user32(struct compat_siginfo __user *to,
>> const struct kernel_siginfo *from)
>> {
>> #if defined(CONFIG_X86_X32_ABI) || defined(CONFIG_IA32_EMULATION)
>> return __copy_siginfo_to_user32(to, from, in_x32_syscall());
>> #else
>> return __copy_siginfo_to_user32(to, from, 0);
>> #endif
>> }
>>
>> Or something like that - I didn't try very hard. We know how to do
>> this stuff, and surely this thing isn't how!
>
> I guess that might be a worthwhile middle ground. Still not a fan of
> all these ifdefs..
>
Can't we move the small X32 specific part out of
__copy_siginfo_to_user32(), in an arch specific helper that voids for
other architectures ?
Something like:
if (!arch_special_something(&new, from)) {
new.si_utime = from->si_utime;
new.si_stime = from->si_stime;
}
Then the arch_special_something() does what it wants in x86 and returns
1, and for architectures not implementating it, a generic version return
0 all the time.
Christophe
Powered by blists - more mailing lists