public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] _FORTIFY_SOURCE=3 improvements
@ 2021-10-12 16:16 Siddhesh Poyarekar
  2021-10-12 16:16 ` [PATCH 1/3] Don't add access size hints to fortifiable functions Siddhesh Poyarekar
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Siddhesh Poyarekar @ 2021-10-12 16:16 UTC (permalink / raw)
  To: libc-alpha

This patchset changes the layout of fortified functions to make them
_FORTIFY_SOURCE=3 friendly and at the same time, continue working the
same for _FORTIFY_SOURCE=2 and lower.  At a high level it makes sure
that no branches are emitted at compile time and only one of either the
regular or _chk version of the function is called.  The conditions are
also reworked to make them more readable and foldable even in cases
where the compiler doesn't know the exact values of the operation length
and size, but can make decisions based on ranges of their values.

The changeset also adds some _FORTIFY_SOURCE=3 testing coverage on
compilers that are able to set that fortification level.

Siddhesh Poyarekar (3):
  Don't add access size hints to fortifiable functions
  Make sure that the fortified function conditionals are constant
  debug: Add tests for _FORTIFY_SOURCE=3

 debug/Makefile                 |  13 +-
 debug/tst-chk1.c               | 102 ++++++++-------
 debug/tst-chk7.c               |   2 +
 debug/tst-chk8.cc              |   2 +
 io/bits/poll2.h                |  31 ++---
 io/sys/poll.h                  |   6 +-
 libio/bits/stdio2.h            | 110 +++++++----------
 libio/stdio.h                  |   4 +-
 misc/sys/cdefs.h               |  71 +++++++++++
 posix/bits/unistd.h            | 174 ++++++--------------------
 posix/unistd.h                 |  28 +++--
 socket/bits/socket2.h          |  34 ++---
 stdlib/bits/stdlib.h           |  57 +++------
 stdlib/stdlib.h                |   5 +-
 string/bits/string_fortified.h |   5 +-
 string/string.h                |   2 +-
 wcsmbs/bits/wchar2.h           | 219 +++++++++------------------------
 17 files changed, 351 insertions(+), 514 deletions(-)
 create mode 100644 debug/tst-chk7.c
 create mode 100644 debug/tst-chk8.cc

-- 
2.31.1


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

end of thread, other threads:[~2021-10-20 14:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 16:16 [PATCH 0/3] _FORTIFY_SOURCE=3 improvements Siddhesh Poyarekar
2021-10-12 16:16 ` [PATCH 1/3] Don't add access size hints to fortifiable functions Siddhesh Poyarekar
2021-10-19 17:54   ` Adhemerval Zanella
2021-10-19 18:19     ` Siddhesh Poyarekar
2021-10-19 18:24       ` Adhemerval Zanella
2021-10-19 18:37         ` Siddhesh Poyarekar
2021-10-12 16:16 ` [PATCH 2/3] Make sure that the fortified function conditionals are constant Siddhesh Poyarekar
2021-10-19 19:34   ` Adhemerval Zanella
2021-10-20  3:16     ` Siddhesh Poyarekar
2021-10-12 16:16 ` [PATCH 3/3] debug: Add tests for _FORTIFY_SOURCE=3 Siddhesh Poyarekar
2021-10-18 13:14 ` [PING][PATCH 0/3] _FORTIFY_SOURCE=3 improvements Siddhesh Poyarekar
2021-10-20  5:24 ` [PATCH v2 0/2] " Siddhesh Poyarekar
2021-10-20  5:24   ` [PATCH v2 1/2] Make sure that the fortified function conditionals are constant Siddhesh Poyarekar
2021-10-20 12:00     ` Adhemerval Zanella
2021-10-20  5:24   ` [PATCH v2 2/2] debug: Add tests for _FORTIFY_SOURCE=3 Siddhesh Poyarekar
2021-10-20 12:06     ` Adhemerval Zanella
2021-10-20 14:28   ` [PATCH v2 0/2] _FORTIFY_SOURCE=3 improvements Siddhesh Poyarekar

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