[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jKv_FHPOwy9q_3szHBz5XPPfLWCSwYax=cHU1nHze-U5A@mail.gmail.com>
Date: Tue, 25 Sep 2018 10:23:20 -0700
From: Kees Cook <keescook@...omium.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Davidlohr Bueso <dave@...olabs.net>,
kernel test robot <rong.a.chen@...el.com>,
Stephen Rothwell <sfr@...b.auug.org.au>, dbueso@...e.de,
Manfred Spraul <manfred@...orfullife.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Michael Kerrisk <mtk.manpages@...il.com>,
Michal Hocko <mhocko@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
LKP <lkp@...org>, ltp@...ts.linux.it
Subject: Re: [PATCH] ipc/shm: properly return EIDRM in shm_lock()
On Tue, Sep 25, 2018 at 5:00 AM, Arnd Bergmann <arnd@...db.de> wrote:
> On Fri, Aug 24, 2018 at 5:09 AM Davidlohr Bueso <dave@...olabs.net> wrote:
>>
>> When getting rid of the general ipc_lock(), this was missed
>> furthermore, making the comment around the ipc object validity
>> check bogus. Under EIDRM conditions, callers will in turn not
>> see the error and continue with the operation.
>>
>> Fixes: 82061c57ce9 (ipc: drop ipc_lock())
>> Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
>> ---
>
> Oddly, this change introduces a gcc warning in some configurations
> (i.e. with randstruct enabled):
>
> ipc/shm.c: In function 'shm_lock':
> ipc/shm.c:209:9: note: randstruct: casting between randomized
> structure pointer types (ssa): 'struct shmid_kernel' and 'struct
> kern_ipc_perm'
> return (void *)ipcp;
> ^~~~~~~~~~~~
>
> Not sure why we didn't see that warning before, probably
> it ended up making its own thing when the return code
> was uninitialized.
The fix is already queued up in mmotm:
https://www.ozlabs.org/~akpm/mmotm/broken-out/ipc-shm-use-err_cast-for-shm_lock-error-return.patch
randstruct stays quiet about ERR_PTR-family casts since they're not
"real" casts to a functional struct.
-Kees
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists