Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641091 > unrolled thread

Re: [PATCH] ipc/sem: Avoid indexing past end of sem_array

Started byManfred Spraul <manfred@colorfullife.com>
First post2017-05-14 16:00 +0200
Last post2017-05-15 19:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] ipc/sem: Avoid indexing past end of sem_array Manfred Spraul <manfred@colorfullife.com> - 2017-05-14 16:00 +0200
    Re: [PATCH] ipc/sem: Avoid indexing past end of sem_array Kees Cook <keescook@chromium.org> - 2017-05-15 19:50 +0200

#1641091 — Re: [PATCH] ipc/sem: Avoid indexing past end of sem_array

FromManfred Spraul <manfred@colorfullife.com>
Date2017-05-14 16:00 +0200
SubjectRe: [PATCH] ipc/sem: Avoid indexing past end of sem_array
Message-ID<tH2dY-2fX-19@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi Kees,

On 05/09/2017 12:23 AM, Kees Cook wrote:
> This changes the struct + trailing data pattern to using a void * so that
> the end of sem_array is found without possibly indexing past the end which
> can upset some static analyzers. Mostly, this ends up avoiding a cast
> between different non-void types, which the future randstruct GCC plugin
> was warning about.
Two question:
- Would the attached patch work with the randstruct plugin as well?
   If we touch the code, then I would propose that we remove sem_base 
entirely.

- ipc/util.h contains

 > #define ipc_rcu_to_struct(p)  ((void *)(p+1))

Does this trigger a warning with randstruct as well?
If we have to touch it, then I would remove it by merging struct 
kern_ipc_perm and struct ipc_rcu.

And, obviously:
Do you see any issues with the attached patch?
--
     Manfred

[toc] | [next] | [standalone]


#1641934

FromKees Cook <keescook@chromium.org>
Date2017-05-15 19:50 +0200
Message-ID<tHsi6-2M0-19@gated-at.bofh.it>
In reply to#1641091
On Sun, May 14, 2017 at 6:54 AM, Manfred Spraul
<manfred@colorfullife.com> wrote:
> Hi Kees,
>
> On 05/09/2017 12:23 AM, Kees Cook wrote:
>>
>> This changes the struct + trailing data pattern to using a void * so that
>> the end of sem_array is found without possibly indexing past the end which
>> can upset some static analyzers. Mostly, this ends up avoiding a cast
>> between different non-void types, which the future randstruct GCC plugin
>> was warning about.
>
> Two question:
> - Would the attached patch work with the randstruct plugin as well?
>   If we touch the code, then I would propose that we remove sem_base
> entirely.

I'll double check with your series, but I think your change makes
sense regardless (since it makes it very clear that there are
allocated sems after the struct due to the [0] entry).

>
> - ipc/util.h contains
>
>> #define ipc_rcu_to_struct(p)  ((void *)(p+1))
>
> Does this trigger a warning with randstruct as well?
> If we have to touch it, then I would remove it by merging struct
> kern_ipc_perm and struct ipc_rcu.
>
> And, obviously:
> Do you see any issues with the attached patch?

I'll test your series with the randstruct series and see what falls out. :)

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web