All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian Göttsche" <cgzones@googlemail.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH userspace 1/2] libselinux: fix invalid free in store_stem()/load_mmap()
Date: Wed, 12 May 2021 12:56:33 +0200	[thread overview]
Message-ID: <CAJ2a_Dfacd18naq_FnnG86B_erzWW9z-EPjqf088mEHfREwGrw@mail.gmail.com> (raw)
In-Reply-To: <20210512102529.122753-2-omosnace@redhat.com>

Am Mi., 12. Mai 2021 um 12:25 Uhr schrieb Ondrej Mosnacek <omosnace@redhat.com>:
>
> Building libselinux with GCC 11.1.1 produces the following warning:
> ```
> In file included from label_file.c:24:
> In function ‘store_stem’,
>     inlined from ‘load_mmap’ at label_file.c:277:12,
>     inlined from ‘process_file’ at label_file.c:551:5:
> label_file.h:289:25: error: ‘free’ called on pointer ‘*mmap_area.next_addr’ with nonzero offset 4 [-Werror=free-nonheap-object]
>   289 |                         free(buf);
>       |                         ^~~~~~~~~
> ```
>
> Indeed, in this case the pointer shouldn't be freed as it comes from
> mmap. Fix this by adding a from_mmap parameter to store_stem() instead
> of overriding the saved_data::from_mmap value in load_mmap().
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

See https://patchwork.kernel.org/project/selinux/patch/20210503175350.55954-17-cgzones@googlemail.com/
for an alternative.

  reply	other threads:[~2021-05-12 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 10:25 [PATCH userspace 0/2] Bump testsuite CI image to F34 Ondrej Mosnacek
2021-05-12 10:25 ` [PATCH userspace 1/2] libselinux: fix invalid free in store_stem()/load_mmap() Ondrej Mosnacek
2021-05-12 10:56   ` Christian Göttsche [this message]
2021-05-18 18:43     ` Petr Lautrbach
2021-05-12 10:25 ` [PATCH userspace 2/2] scripts/ci: use F34 image instead of F33 Ondrej Mosnacek
2021-05-12 16:18   ` Petr Lautrbach
2021-05-18  8:05     ` Petr Lautrbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ2a_Dfacd18naq_FnnG86B_erzWW9z-EPjqf088mEHfREwGrw@mail.gmail.com \
    --to=cgzones@googlemail.com \
    --cc=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.