public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Bugaev <bugaevc@gmail.com>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments
Date: Tue, 23 May 2023 23:01:23 +0300	[thread overview]
Message-ID: <CAN9u=HcwrjrTSgrdfON_eDpo0wtPmX1M5OHcHLkV6CUK+3neOw@mail.gmail.com> (raw)
In-Reply-To: <be0c6485-b43a-256e-41f9-71181a0b17b1@gotplt.org>

Hello,

On Tue, May 23, 2023 at 10:15 PM Siddhesh Poyarekar <siddhesh@gotplt.org> wrote:
> *_chk but I don't want to block this good work on that.  The overall
> direction is good IMO

Yay, thanks!

> - manual/contrib.texi should be updated to mention fcntl

Do you mean manual/maint.texi? manual/contrib.texi seems to contain a
list of contributors.

> - Internal users end up calling __libc_fcntl (see dup2.c or grantpt.c
> for example), which will essentially bypass any fortification.  This is
> not a problem today since we don't build glibc with fortification, but
> Frederic Berat[1] has been experimenting with that and we're hoping to
> get at least a subset of glibc fortified for 2.38.  It would be a shame
> to miss fortifying glibc itself.  This is again not a problem that would
> block this patch, but something to be aware of.

Yes, I've thought of this, but I don't know what I could change in
this patch to make it friendlier to in-glibc fortification. I've
generally done things the same way as the open* fortification does; so
I don't think this would be adding any new complications compared to
what's already in there.

> Given that this will error out at compile time, do we even need this
> __fcntl64_2 call?

Same as for the open* fortification: this call will only fail at
compile time if the cmd is a compile-time constant. If it's not (which
is a rare, but valid case), we need to do the check at runtime. Note
that if cmd _is_ a compile-time constant and does not require the 3rd
arg, this will call the regular fcntl, not the _2 version; the _2
version is only for non-compile-time-const cmd-s.

Sergey

  reply	other threads:[~2023-05-23 20:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 21:30 [RFC PATCH 0/1] Attempt to detect missing fcntl argument at compile time Sergey Bugaev
2023-05-19 21:30 ` [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Sergey Bugaev
2023-05-19 21:55   ` Joseph Myers
2023-05-20 11:46     ` Sergey Bugaev
2023-05-20 18:21       ` [RFC PATCH] debug: Add tests for fortified fcntl () Sergey Bugaev
2023-05-23 18:40         ` Adhemerval Zanella Netto
2023-05-23 19:19           ` Sergey Bugaev
2023-05-23 19:48             ` Adhemerval Zanella Netto
2023-05-24  7:15               ` Sergey Bugaev
2023-05-24 12:15                 ` Adhemerval Zanella Netto
2023-05-23 19:09   ` [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Adhemerval Zanella Netto
2023-05-23 19:43     ` Sergey Bugaev
2023-05-23 19:56       ` Adhemerval Zanella Netto
2023-05-23 20:24         ` Sergey Bugaev
2023-05-23 20:44           ` Sergey Bugaev
2023-05-24 12:04           ` Adhemerval Zanella Netto
2023-05-23 19:15   ` Siddhesh Poyarekar
2023-05-23 20:01     ` Sergey Bugaev [this message]
2023-05-23 20:06       ` Sergey Bugaev
2023-05-23 21:46   ` Florian Weimer
2023-05-24  7:31     ` Sergey Bugaev
2023-05-24  8:29       ` Florian Weimer
2023-05-24 10:51         ` Sergey Bugaev
2023-05-24 11:18           ` Florian Weimer
2023-05-24 11:46             ` Siddhesh Poyarekar
2023-05-24 12:12               ` Andreas Schwab
2023-05-24 12:18                 ` Florian Weimer
2023-05-24 12:37                   ` Sergey Bugaev
2023-05-24 12:45                     ` Florian Weimer
2023-05-24 13:02                       ` Sergey Bugaev
2023-05-24 13:18                         ` Florian Weimer

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='CAN9u=HcwrjrTSgrdfON_eDpo0wtPmX1M5OHcHLkV6CUK+3neOw@mail.gmail.com' \
    --to=bugaevc@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).