[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJyRWTJJkSqN-eAL6Y39s7tWccamP8mFF2C7vyXVNgbvg@mail.gmail.com>
Date: Mon, 15 May 2017 15:16:00 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Manfred Spraul <manfred@...orfullife.com>,
Michael Kerrisk <mtk.manpages@...il.com>,
LKML <linux-kernel@...r.kernel.org>, 1vier1@....de,
Davidlohr Bueso <dave@...olabs.net>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Fabian Frederick <fabf@...net.be>
Subject: Re: [PATCH 1/3] ipc/sem.c: remove sem_base, embed struct sem
On Mon, May 15, 2017 at 1:08 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Mon, 15 May 2017 19:19:10 +0200 Manfred Spraul <manfred@...orfullife.com> wrote:
>
>> sma->sem_base is initialized with
>> sma->sem_base = (struct sem *) &sma[1];
>>
>> The current code has four problems:
>> - There is an unnecessary pointer dereference - sem_base is not needed.
>> - Alignment for struct sem only works by chance.
>> - The current code causes false positive for static code analysis.
>> - This is a cast between different non-void types, which the future
>> randstruct GCC plugin warns on.
>>
>> And, as bonus, the code size gets smaller:
>>
>> Before:
>> 0 .text 00003770
>> After:
>> 0 .text 0000374e
>
>
> This clashes with Kees's patch, below. Does it have the same effect?
This is a better clean up than what I've got. I haven't had a chance
to verify this is sufficient for randstruct (I think it is), but I'll
check and send any another needed fixes separately.
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists