[v2,0/2] _FORTIFY_SOURCE fixes [BZ #28746]

Message ID 20220105044516.905688-1-siddhesh@sourceware.org
Headers
Series _FORTIFY_SOURCE fixes [BZ #28746] |

Message

Siddhesh Poyarekar Jan. 5, 2022, 4:45 a.m. UTC
  The main patch is 2/2, which fixes some fortified headers to match
feature macros with their corresponding main headers, without which
functions would fail to get fortified.  Patch 1/2 is a restructuring of
the tests so that it is easier to add different configurations to
_FORTIFY_SOURCE tests at various levels.

Tested on x86_64 to confirm that there were no new regressions due to
this and that the new tests also run clean.

Changes from v1:
- Rebased against latest trunk so that the patches actually apply.
- Renamed files so that the diffs are easier to compare and also make a
  bit more sense.

Siddhesh Poyarekar (2):
  debug: Refactor and expand _FORTIFY_SOURCE tests
  debug: Synchronize feature guards in fortified functions [BZ #28746]

 debug/Makefile                               | 80 ++++++++++----------
 debug/{tst-lfschk1.c => tst-chk-0-cc-lfs.cc} |  2 +-
 debug/tst-chk-0-cc-nongnu.cc                 |  3 +
 debug/tst-chk-0-cc.cc                        |  1 +
 debug/{tst-lfschk2.c => tst-chk-0-lfs.c}     |  2 +-
 debug/tst-chk-0-nongnu.c                     |  3 +
 debug/{tst-chk1.c => tst-chk-0.c}            | 49 ++++++++++--
 debug/{tst-lfschk3.c => tst-chk-1-cc-lfs.cc} |  2 +-
 debug/tst-chk-1-cc-nongnu.cc                 |  3 +
 debug/{tst-chk5.cc => tst-chk-1-cc.cc}       |  2 +-
 debug/{tst-lfschk4.cc => tst-chk-1-lfs.c}    |  2 +-
 debug/tst-chk-1-nongnu.c                     |  3 +
 debug/{tst-chk2.c => tst-chk-1.c}            |  2 +-
 debug/tst-chk-2-cc-lfs.cc                    |  2 +
 debug/tst-chk-2-cc-nongnu.cc                 |  3 +
 debug/{tst-chk6.cc => tst-chk-2-cc.cc}       |  2 +-
 debug/tst-chk-2-lfs.c                        |  2 +
 debug/tst-chk-2-nongnu.c                     |  3 +
 debug/{tst-chk3.c => tst-chk-2.c}            |  2 +-
 debug/tst-chk-3-cc-lfs.cc                    |  2 +
 debug/tst-chk-3-cc-nongnu.cc                 |  3 +
 debug/{tst-chk7.c => tst-chk-3-cc.cc}        |  2 +-
 debug/tst-chk-3-lfs.c                        |  2 +
 debug/tst-chk-3-nongnu.c                     |  3 +
 debug/{tst-chk8.cc => tst-chk-3.c}           |  2 +-
 debug/tst-chk4.cc                            |  1 -
 debug/tst-lfschk5.cc                         |  2 -
 debug/tst-lfschk6.cc                         |  2 -
 posix/bits/unistd.h                          |  2 +-
 string/bits/string_fortified.h               |  8 +-
 support/xsignal.h                            |  2 +
 wcsmbs/bits/wchar2.h                         |  2 +-
 32 files changed, 131 insertions(+), 70 deletions(-)
 rename debug/{tst-lfschk1.c => tst-chk-0-cc-lfs.cc} (55%)
 create mode 100644 debug/tst-chk-0-cc-nongnu.cc
 create mode 100644 debug/tst-chk-0-cc.cc
 rename debug/{tst-lfschk2.c => tst-chk-0-lfs.c} (55%)
 create mode 100644 debug/tst-chk-0-nongnu.c
 rename debug/{tst-chk1.c => tst-chk-0.c} (97%)
 rename debug/{tst-lfschk3.c => tst-chk-1-cc-lfs.cc} (55%)
 create mode 100644 debug/tst-chk-1-cc-nongnu.cc
 rename debug/{tst-chk5.cc => tst-chk-1-cc.cc} (53%)
 rename debug/{tst-lfschk4.cc => tst-chk-1-lfs.c} (55%)
 create mode 100644 debug/tst-chk-1-nongnu.c
 rename debug/{tst-chk2.c => tst-chk-1.c} (53%)
 create mode 100644 debug/tst-chk-2-cc-lfs.cc
 create mode 100644 debug/tst-chk-2-cc-nongnu.cc
 rename debug/{tst-chk6.cc => tst-chk-2-cc.cc} (53%)
 create mode 100644 debug/tst-chk-2-lfs.c
 create mode 100644 debug/tst-chk-2-nongnu.c
 rename debug/{tst-chk3.c => tst-chk-2.c} (53%)
 create mode 100644 debug/tst-chk-3-cc-lfs.cc
 create mode 100644 debug/tst-chk-3-cc-nongnu.cc
 rename debug/{tst-chk7.c => tst-chk-3-cc.cc} (53%)
 create mode 100644 debug/tst-chk-3-lfs.c
 create mode 100644 debug/tst-chk-3-nongnu.c
 rename debug/{tst-chk8.cc => tst-chk-3.c} (53%)
 delete mode 100644 debug/tst-chk4.cc
 delete mode 100644 debug/tst-lfschk5.cc
 delete mode 100644 debug/tst-lfschk6.cc