public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Attempt to detect missing fcntl argument at compile time
@ 2023-05-19 21:30 Sergey Bugaev
  2023-05-19 21:30 ` [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Sergey Bugaev
  0 siblings, 1 reply; 31+ messages in thread
From: Sergey Bugaev @ 2023-05-19 21:30 UTC (permalink / raw)
  To: libc-alpha

Hello,

here goes another attempt to step out of the comfort zone into the
"I don't know what I'm doing" zone -- this time with fcntl and inline
wrappers and FORTIFY_SOURCE.

It *appears* to build and work and not break anything; I've tried
x86_64-gnu, i686-gnu, i686-linux-gnu, and x86_64-linux-gnu. On
i686-linux-gnu I've tried defining various macros, such as
_LARGEFILE64_SOURCE and _FILE_OFFSET_BITS (to 32 or 64). Things *appear*
to work just as I expect them to; the build breaks when I try to compile
an fcntl () without a required argument, and I do get an error at
runtime as expected too. All the right symbols appear to get referenced
in all configurations, too.

Still, I'm not very sure I've handled all the possible configurations
correctly.

The reasoning for __fcntl_cmd_needs_arg () being a function and not a
macro is that the definition needs to use multiple #ifdefs and that
would be awkward with a macro. Hopefully I have handled various
combinations of fcntl commands being defined / not defined correctly
too, so the user never gets a compilation error just because
__fcntl_cmd_needs_arg () wants to handle some command that is not
defined in their configuration. When building fcntl{,64}_2.c, all the
commands (that are supported on this kernel, i.e. not Linux specifics
on the Hurd) should be defined, and so the runtime calls to
__fcntl_cmd_needs_arg () get this full version. When building user code,
some commands may not be defined (depending on enabled feature macros),
but then the expectation is the user cannot use those commands they do
not have enabled.

Sergey

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2023-05-24 13:18 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).