[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8bd0f97a0906240435w629c5fd9m352fde5060376b0f@mail.gmail.com>
Date: Wed, 24 Jun 2009 07:35:12 -0400
From: Mike Frysinger <vapier.adi@...il.com>
To: Al Viro <viro@....linux.org.uk>
Cc: Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] asm-generic: uaccess: do not expand args multiple
times
On Wed, Jun 24, 2009 at 00:38, Al Viro wrote:
> On Sun, Jun 14, 2009 at 10:14:39PM +0200, Arnd Bergmann wrote:
>> On Sunday 14 June 2009, Mike Frysinger wrote:
>> > While it's debatable whether {get,put}_user() should be called with
>> > arguments that have side effects, macro's should be written safely in the
>> > first place. In this case, a slightly off version of put_user() ended up
>> > causing random userspace corruption and these things aren't trivial to
>> > track down.
>> >
>> > While some of these conversions aren't strictly necessary, I think it's
>> > better to do all of them so as to be proactive in people accidently
>> > screwing it up in the future.
>>
>> I've tried this and failed. This change adds an endless number of sparse
>> warnings in put_user and even gcc warnings in get_user. The problem
>> is that typeof() carries over the 'const' and '__user' modifiers, both
>> of which prevent you from assigning data to the new pointer that you
>> constructed.
>>
>> I'd love to see a way to do this correctly, but this patch won't cut it.
>
> Note that sizeof(*(ptr)) does *NOT* evaluate ptr, unless we are dealing
> with variably-modified type. The same goes for typeof. And chk_user_ptr()
> expands to (void)0 during the build.
i never said it does -- i explicitly said i converted more than needed
on purpose
> So I don't believe that existing variant
> is incorrect - we do not evaluate the argument twice.
except that it does. read get_user() where the argument is expanded
once for access_ok() and twice when tailing to __get_user(). same
goes for put_user().
-mike
--
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