diff options
| author | Khem Raj <raj.khem@gmail.com> | 2020-01-26 11:27:43 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-27 16:48:09 +0000 |
| commit | 81437a813ff18ac95cb5fdcc7e40dd9a98678707 (patch) | |
| tree | 3b4f012e7cee70c5a6320a008e9514f363f5096e | |
| parent | 176d1c0169b84978648230ab98cf966640ae8ce0 (diff) | |
| download | poky-81437a813ff18ac95cb5fdcc7e40dd9a98678707.tar.gz | |
glibc: Update to final 2.31 release
Drop ppc 8xx clear cache optimization, which we have been carrying
through eglibc days, it has been redone in glibc now
(From OE-Core rev: 5c48e655cbd9a45d43c37602db8e09e2e91d2722)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
34 files changed, 367 insertions, 449 deletions
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.31.bb b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb index a267a591d4..24de55d929 100644 --- a/meta/recipes-core/glibc/cross-localedef-native_2.31.bb +++ b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb | |||
| @@ -31,11 +31,10 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
| 31 | file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ | 31 | file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ |
| 32 | file://0020-eglibc-Cross-building-and-testing-instructions.patch \ | 32 | file://0020-eglibc-Cross-building-and-testing-instructions.patch \ |
| 33 | file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ | 33 | file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ |
| 34 | file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \ | 34 | file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \ |
| 35 | file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \ | 35 | file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \ |
| 36 | file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \ | 36 | file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \ |
| 37 | file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \ | 37 | file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ |
| 38 | file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ | ||
| 39 | " | 38 | " |
| 40 | # Makes for a rather long rev (22 characters), but... | 39 | # Makes for a rather long rev (22 characters), but... |
| 41 | # | 40 | # |
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc index dca1916e80..c2cfb7e2f1 100644 --- a/meta/recipes-core/glibc/glibc-version.inc +++ b/meta/recipes-core/glibc/glibc-version.inc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | SRCBRANCH ?= "master" | 1 | SRCBRANCH ?= "master" |
| 2 | PV = "2.30.9000" | 2 | PV = "2.30.9000" |
| 3 | SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477" | 3 | SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410" |
| 4 | SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655" | 4 | SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655" |
| 5 | 5 | ||
| 6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" | 6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" |
diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch index 9b75f2a62f..d0786be8b8 100644 --- a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch +++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 169720859cf8f9133882a13f588b15f44b7b8ae6 Mon Sep 17 00:00:00 2001 | 1 | From 3dcf144e998aed17b3fb957a255b1e923ba07d71 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | 2 | From: Jason Wessel <jason.wessel@windriver.com> |
| 3 | Date: Sat, 7 Dec 2019 09:59:22 -0800 | 3 | Date: Sat, 7 Dec 2019 09:59:22 -0800 |
| 4 | Subject: [PATCH] localedef: Add hardlink resolver from util-linux | 4 | Subject: [PATCH] localedef: Add hardlink resolver from util-linux |
diff --git a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch index 029292fe36..5222e37d1a 100644 --- a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch +++ b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 9b966b758d0c96ef6654251689318614ef10becc Mon Sep 17 00:00:00 2001 | 1 | From b52dba15527380cc18635e3696e0ef87efee9a84 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | 2 | From: Jason Wessel <jason.wessel@windriver.com> |
| 3 | Date: Sat, 7 Dec 2019 10:01:37 -0800 | 3 | Date: Sat, 7 Dec 2019 10:01:37 -0800 |
| 4 | Subject: [PATCH] localedef: fix-ups hardlink to make it compile | 4 | Subject: [PATCH] localedef: fix-ups hardlink to make it compile |
diff --git a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch index e1c3512e4e..4cdc8354b6 100644 --- a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch +++ b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 14ddf13b7fc2e39a1ae657ceb3963e35731e95d0 Mon Sep 17 00:00:00 2001 | 1 | From 6987ad183770cb56680ccc4f6ea065a04f31ccb6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 01:48:24 +0000 | 3 | Date: Wed, 18 Mar 2015 01:48:24 +0000 |
| 4 | Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well | 4 | Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well |
diff --git a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch index 523b6da897..62e12897f5 100644 --- a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch +++ b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 3ac58bf1028841cc0a8fa7f258cbf21466740360 Mon Sep 17 00:00:00 2001 | 1 | From 7806340c2accc2c51e7e861b618c29fb5609a007 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 01:50:00 +0000 | 3 | Date: Wed, 18 Mar 2015 01:50:00 +0000 |
| 4 | Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK | 4 | Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK |
diff --git a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch index 4d88d9b413..294c2b975e 100644 --- a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch +++ b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 702d68cbdf405e086f72e2a062127cbea43045ec Mon Sep 17 00:00:00 2001 | 1 | From 1b97befbe693eb93a77b6098f6ae1394a53462f4 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 01:51:38 +0000 | 3 | Date: Wed, 18 Mar 2015 01:51:38 +0000 |
| 4 | Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths | 4 | Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths |
diff --git a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch index 0d070a93b9..db8b6c0f1c 100644 --- a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch +++ b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From f9993e652bd4a0f03402d0c527cf24b83d0ff7ea Mon Sep 17 00:00:00 2001 | 1 | From a752857cc342ee5136c9a593037b6ee6ff8af8ee Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 31 Dec 2015 14:35:35 -0800 | 3 | Date: Thu, 31 Dec 2015 14:35:35 -0800 |
| 4 | Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 | 4 | Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 |
diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch index 66abcce3ce..d9985c2fdc 100644 --- a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From ee9d5e423e4a709ae5a62abfb476863b3b57378f Mon Sep 17 00:00:00 2001 | 1 | From 3df91d1d8b9c7a01b3ef8133c4f9b9764227d583 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 3 Aug 2018 09:55:12 -0700 | 3 | Date: Fri, 3 Aug 2018 09:55:12 -0700 |
| 4 | Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales | 4 | Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales |
diff --git a/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch index 4f3ed38065..3dac325380 100644 --- a/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch +++ b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 2cc7b79157ce17144791dda1a2e3a6dc4902c736 Mon Sep 17 00:00:00 2001 | 1 | From 61b6c9737897c5828ef4b40699ee0a74c570034a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:01:50 +0000 | 3 | Date: Wed, 18 Mar 2015 00:01:50 +0000 |
| 4 | Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation | 4 | Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation |
diff --git a/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch index 6e4259f4ff..456f91fb8e 100644 --- a/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch +++ b/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From e6ff3960d9e4ed6a9a4be70732313127f0e6d0e0 Mon Sep 17 00:00:00 2001 | 1 | From 13beb1f428ec06778590bf526d6e641f73d5cf62 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:11:22 +0000 | 3 | Date: Wed, 18 Mar 2015 00:11:22 +0000 |
| 4 | Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names | 4 | Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names |
diff --git a/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch index 91da344089..01446abc43 100644 --- a/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch +++ b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From ad055d58bd99b80e41face63bf20db3f04afa4e3 Mon Sep 17 00:00:00 2001 | 1 | From 4483a83074a340a921e319b88d72166f18e0df0b Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:15:07 +0000 | 3 | Date: Wed, 18 Mar 2015 00:15:07 +0000 |
| 4 | Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite' | 4 | Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite' |
diff --git a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch index 6a5a44af9d..451f372650 100644 --- a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch +++ b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From ac4450bc74dc0754a3724f1bebb2290c4dc29d72 Mon Sep 17 00:00:00 2001 | 1 | From 347b2e31d010b04c42e78157a028aa1d58fe0f5e Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:16:38 +0000 | 3 | Date: Wed, 18 Mar 2015 00:16:38 +0000 |
| 4 | Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out | 4 | Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out |
diff --git a/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch index e8eaa4d90b..a0b46c0479 100644 --- a/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch +++ b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 0c73e17d5ea7c88247c1bfbb03511b0ccb6ba6b4 Mon Sep 17 00:00:00 2001 | 1 | From 8ca8e5cd78cbd37a713e1181f8f6641b57352aa8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:20:09 +0000 | 3 | Date: Wed, 18 Mar 2015 00:20:09 +0000 |
| 4 | Subject: [PATCH] Quote from bug 1443 which explains what the patch does : | 4 | Subject: [PATCH] Quote from bug 1443 which explains what the patch does : |
diff --git a/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch index 3b3611f448..736de8cf04 100644 --- a/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch +++ b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 6a1ebbab0643fb2169314bcf1a0850b0f06dd27e Mon Sep 17 00:00:00 2001 | 1 | From 21509735678990760d5ebf9d0c65efa4b52b838d Mon Sep 17 00:00:00 2001 |
| 2 | From: Ting Liu <b28495@freescale.com> | 2 | From: Ting Liu <b28495@freescale.com> |
| 3 | Date: Wed, 19 Dec 2012 04:39:57 -0600 | 3 | Date: Wed, 19 Dec 2012 04:39:57 -0600 |
| 4 | Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S} | 4 | Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S} |
diff --git a/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch index b35de40eea..e73b640c16 100644 --- a/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch +++ b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 106aee1de5c95fc9e02f10c05537dcc39f8478f4 Mon Sep 17 00:00:00 2001 | 1 | From e33deb119734ef443ef44c42a00a569f90e1e149 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:24:46 +0000 | 3 | Date: Wed, 18 Mar 2015 00:24:46 +0000 |
| 4 | Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out | 4 | Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out |
diff --git a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch index 5669341916..0cdd0567df 100644 --- a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch +++ b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 6c07d094556606ce7c1dc08f4dd3bc6af483364f Mon Sep 17 00:00:00 2001 | 1 | From c50cae36e90c41849301a9a668adf31e81e43a07 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:27:10 +0000 | 3 | Date: Wed, 18 Mar 2015 00:27:10 +0000 |
| 4 | Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly | 4 | Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly |
diff --git a/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch index 3e5bba5a59..574e7c3503 100644 --- a/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch +++ b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 8a8c81ba4e652dddb730d3dad2fecab1ee65fd9c Mon Sep 17 00:00:00 2001 | 1 | From c323125744020a29f79e50dc4d024b55c482eafc Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:28:41 +0000 | 3 | Date: Wed, 18 Mar 2015 00:28:41 +0000 |
| 4 | Subject: [PATCH] Add unused attribute | 4 | Subject: [PATCH] Add unused attribute |
diff --git a/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch index 0b626bdfac..49089af41e 100644 --- a/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch +++ b/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 601b2d11b6ddd974f0e1685f70e0d368e706d976 Mon Sep 17 00:00:00 2001 | 1 | From c421cd7e885497a99179b982dc4a27e8405f8857 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:31:06 +0000 | 3 | Date: Wed, 18 Mar 2015 00:31:06 +0000 |
| 4 | Subject: [PATCH] 'yes' within the path sets wrong config variables | 4 | Subject: [PATCH] 'yes' within the path sets wrong config variables |
diff --git a/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch index f18c7a1107..20b0ee98ea 100644 --- a/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch +++ b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 8678c584bca244fe9a3f8926eabb6b6c7e9784f1 Mon Sep 17 00:00:00 2001 | 1 | From 2023d88c355b8af6458c8e39ce38b75c1ca4ea2a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:33:03 +0000 | 3 | Date: Wed, 18 Mar 2015 00:33:03 +0000 |
| 4 | Subject: [PATCH] timezone: re-written tzselect as posix sh | 4 | Subject: [PATCH] timezone: re-written tzselect as posix sh |
diff --git a/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch index 82026694de..1c15a51308 100644 --- a/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch +++ b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From a78f21f2f9b9246cd12b310833313328e8f646ed Mon Sep 17 00:00:00 2001 | 1 | From 06da20d9f89907e5f2777537244e6589ca3c9703 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 31 Dec 2015 14:33:02 -0800 | 3 | Date: Thu, 31 Dec 2015 14:33:02 -0800 |
| 4 | Subject: [PATCH] Remove bash dependency for nscd init script | 4 | Subject: [PATCH] Remove bash dependency for nscd init script |
diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch index f8f3efe582..eda5565371 100644 --- a/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch +++ b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 7c48f61b0c5ef6274df4b03609991d383adc5df0 Mon Sep 17 00:00:00 2001 | 1 | From 5641452a24f76c5dafa3749a542fcac93f77390f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:42:58 +0000 | 3 | Date: Wed, 18 Mar 2015 00:42:58 +0000 |
| 4 | Subject: [PATCH] eglibc: Cross building and testing instructions | 4 | Subject: [PATCH] eglibc: Cross building and testing instructions |
diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch index 02e5def339..6374ea4086 100644 --- a/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch +++ b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 86a6e94e86664976b305c24e5a52093fe962240a Mon Sep 17 00:00:00 2001 | 1 | From 6a32d5bf40deee5d12d24c06f3ea9b5479c16802 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:49:28 +0000 | 3 | Date: Wed, 18 Mar 2015 00:49:28 +0000 |
| 4 | Subject: [PATCH] eglibc: Help bootstrap cross toolchain | 4 | Subject: [PATCH] eglibc: Help bootstrap cross toolchain |
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch deleted file mode 100644 index 913aea9563..0000000000 --- a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch +++ /dev/null | |||
| @@ -1,80 +0,0 @@ | |||
| 1 | From b397d653670dd02d8310e1d6f0f19a8da90ebafa Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 31 Dec 2015 15:15:09 -0800 | ||
| 4 | Subject: [PATCH] eglibc: Clear cache lines on ppc8xx | ||
| 5 | |||
| 6 | 2007-06-13 Nathan Sidwell <nathan@codesourcery.com> | ||
| 7 | Mark Shinwell <shinwell@codesourcery.com> | ||
| 8 | |||
| 9 | * sysdeps/unix/sysv/linux/powerpc/libc-start.c | ||
| 10 | (__libc_start_main): Detect 8xx parts and clear | ||
| 11 | __cache_line_size if detected. | ||
| 12 | * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | ||
| 13 | (DL_PLATFORM_AUXV): Likewise. | ||
| 14 | |||
| 15 | Upstream-Status: Pending | ||
| 16 | |||
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 18 | --- | ||
| 19 | sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 14 +++++++++++++- | ||
| 20 | sysdeps/unix/sysv/linux/powerpc/libc-start.c | 16 +++++++++++++++- | ||
| 21 | 2 files changed, 28 insertions(+), 2 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | ||
| 24 | index 5d65bc6303..c786f9aa7e 100644 | ||
| 25 | --- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | ||
| 26 | +++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | ||
| 27 | @@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden; | ||
| 28 | /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found | ||
| 29 | verify that the static extern __cache_line_size is defined by checking | ||
| 30 | for not NULL. If it is defined then assign the cache block size | ||
| 31 | - value to __cache_line_size. */ | ||
| 32 | + value to __cache_line_size. This is used by memset to | ||
| 33 | + optimize setting to zero. We have to detect 8xx processors, which | ||
| 34 | + have buggy dcbz implementations that cannot report page faults | ||
| 35 | + correctly. That requires reading SPR, which is a privileged | ||
| 36 | + operation. Fortunately 2.2.18 and later emulates PowerPC mfspr | ||
| 37 | + reads from the PVR register. */ | ||
| 38 | #define DL_PLATFORM_AUXV \ | ||
| 39 | case AT_DCACHEBSIZE: \ | ||
| 40 | + if (__LINUX_KERNEL_VERSION >= 0x020218) \ | ||
| 41 | + { \ | ||
| 42 | + unsigned pvr = 0; \ | ||
| 43 | + asm ("mfspr %0, 287" : "=r" (pvr)); \ | ||
| 44 | + if ((pvr & 0xffff0000) == 0x00500000) \ | ||
| 45 | + break; \ | ||
| 46 | + } \ | ||
| 47 | __cache_line_size = av->a_un.a_val; \ | ||
| 48 | break; | ||
| 49 | |||
| 50 | diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c | ||
| 51 | index 93f8659fa6..9bb07b36be 100644 | ||
| 52 | --- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c | ||
| 53 | +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c | ||
| 54 | @@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv, | ||
| 55 | |||
| 56 | /* Initialize the __cache_line_size variable from the aux vector. For the | ||
| 57 | static case, we also need _dl_hwcap, _dl_hwcap2 and _dl_platform, so we | ||
| 58 | - can call __tcb_parse_hwcap_and_convert_at_platform (). */ | ||
| 59 | + can call __tcb_parse_hwcap_and_convert_at_platform (). | ||
| 60 | + | ||
| 61 | + This is used by memset to optimize setting to zero. We have to | ||
| 62 | + detect 8xx processors, which have buggy dcbz implementations that | ||
| 63 | + cannot report page faults correctly. That requires reading SPR, | ||
| 64 | + which is a privileged operation. Fortunately 2.2.18 and later | ||
| 65 | + emulates PowerPC mfspr reads from the PVR register. */ | ||
| 66 | for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av) | ||
| 67 | switch (av->a_type) | ||
| 68 | { | ||
| 69 | case AT_DCACHEBSIZE: | ||
| 70 | + if (__LINUX_KERNEL_VERSION >= 0x020218) | ||
| 71 | + { | ||
| 72 | + unsigned pvr = 0; | ||
| 73 | + | ||
| 74 | + asm ("mfspr %0, 287" : "=r" (pvr) :); | ||
| 75 | + if ((pvr & 0xffff0000) == 0x00500000) | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | __cache_line_size = av->a_un.a_val; | ||
| 79 | break; | ||
| 80 | #ifndef SHARED | ||
diff --git a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch index cc8ddeea6f..2a503c811e 100644 --- a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch +++ b/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 02b69fc14ae1d6309e4e17081842b1f89bd40338 Mon Sep 17 00:00:00 2001 | 1 | From 25c21857a3fc0eb26831616ba88a696dd31ecba1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 00:55:53 +0000 | 3 | Date: Wed, 18 Mar 2015 00:55:53 +0000 |
| 4 | Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 | 4 | Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 |
diff --git a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch index 72278a6822..1a90f22db6 100644 --- a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch +++ b/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 42fc64ee872491667749499db50e3c51d6a4bfb3 Mon Sep 17 00:00:00 2001 | 1 | From 30008327aadf0c775e644bb387d7c25952ed05b5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 18 Mar 2015 01:33:49 +0000 | 3 | Date: Wed, 18 Mar 2015 01:33:49 +0000 |
| 4 | Subject: [PATCH] eglibc: Forward port cross locale generation support | 4 | Subject: [PATCH] eglibc: Forward port cross locale generation support |
diff --git a/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch b/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch index d359518751..15e460eb08 100644 --- a/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch +++ b/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 5e565710aa061ffffd34d8400910c35a8d50a4ec Mon Sep 17 00:00:00 2001 | 1 | From 067f71a381ce6626ef1179be3dd90c4ed2aa52fb Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 20 Apr 2016 21:11:00 -0700 | 3 | Date: Wed, 20 Apr 2016 21:11:00 -0700 |
| 4 | Subject: [PATCH] Define DUMMY_LOCALE_T if not defined | 4 | Subject: [PATCH] Define DUMMY_LOCALE_T if not defined |
diff --git a/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch index 8df09d82ee..543f65d6ea 100644 --- a/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch +++ b/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From c5b63c8eafc00e01556edd2acff4c541448924cf Mon Sep 17 00:00:00 2001 | 1 | From 8f4b0bac85d14b184e08848b02de3f30775f05b1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 3 Aug 2018 09:42:06 -0700 | 3 | Date: Fri, 3 Aug 2018 09:42:06 -0700 |
| 4 | Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path | 4 | Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path |
diff --git a/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch index 55250d8d8e..5f6ee40f22 100644 --- a/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch +++ b/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From d3349ae8d9b17fecf6ef560b845d04d682db291c Mon Sep 17 00:00:00 2001 | 1 | From 1dad746ce93928a57b2fe618c74722f710751826 Mon Sep 17 00:00:00 2001 |
| 2 | From: Mark Hatle <mark.hatle@windriver.com> | 2 | From: Mark Hatle <mark.hatle@windriver.com> |
| 3 | Date: Thu, 18 Aug 2016 14:07:58 -0500 | 3 | Date: Thu, 18 Aug 2016 14:07:58 -0500 |
| 4 | Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first | 4 | Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first |
diff --git a/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch index 06d23c988d..2c317d58aa 100644 --- a/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch +++ b/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 3650ad7f01509138aa72f235e680c9d4f6c09a7d Mon Sep 17 00:00:00 2001 | 1 | From 3c8d9eae83ab4f1677afc9b379f97114e8503363 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 3 Aug 2018 09:44:00 -0700 | 3 | Date: Fri, 3 Aug 2018 09:44:00 -0700 |
| 4 | Subject: [PATCH] intl: Emit no lines in bison generated files | 4 | Subject: [PATCH] intl: Emit no lines in bison generated files |
diff --git a/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch b/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch index 62e615786d..e1a030d10c 100644 --- a/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch +++ b/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From a9be0c7c67e67d870e2c5e0ece4f6ac76e5c0fe2 Mon Sep 17 00:00:00 2001 | 1 | From 420454f7098b5445730caa855c37b8143bfccc1b Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 29 Nov 2018 17:29:35 -0800 | 3 | Date: Thu, 29 Nov 2018 17:29:35 -0800 |
| 4 | Subject: [PATCH] inject file assembly directives | 4 | Subject: [PATCH] inject file assembly directives |
diff --git a/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch index 195b1b0081..c8c359f2b8 100644 --- a/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch +++ b/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From eaa1e89df6d760c3719e7060662c60b41ab6e87b Mon Sep 17 00:00:00 2001 | 1 | From 66963ad83bdd3b075006ddca9dfe357aed181d6a Mon Sep 17 00:00:00 2001 |
| 2 | From: Martin Jansa <martin.jansa@gmail.com> | 2 | From: Martin Jansa <martin.jansa@gmail.com> |
| 3 | Date: Mon, 17 Dec 2018 21:36:18 +0000 | 3 | Date: Mon, 17 Dec 2018 21:36:18 +0000 |
| 4 | Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ | 4 | Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ |
diff --git a/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch b/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch index fe10218c31..7fe71ad92f 100644 --- a/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch +++ b/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 4a6f67ae2438c5e7f9cd627d5cf4a7148b9ad18d Mon Sep 17 00:00:00 2001 | 1 | From fecfc4050ce075e543fb1cf19d6d1da481260b95 Mon Sep 17 00:00:00 2001 |
| 2 | From: George Burgess IV <gbiv@google.com> | 2 | From: George Burgess IV <gbiv@google.com> |
| 3 | Date: Sat, 11 Jan 2020 10:33:19 -0800 | 3 | Date: Sat, 11 Jan 2020 10:33:19 -0800 |
| 4 | Subject: [PATCH] Refactor FORTIFY in glibc | 4 | Subject: [PATCH] Refactor FORTIFY in glibc |
| @@ -24,9 +24,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 24 | wcsmbs/bits/wchar2.h | 487 ++++++++++++++------------------ | 24 | wcsmbs/bits/wchar2.h | 487 ++++++++++++++------------------ |
| 25 | 14 files changed, 1093 insertions(+), 837 deletions(-) | 25 | 14 files changed, 1093 insertions(+), 837 deletions(-) |
| 26 | 26 | ||
| 27 | diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h | ||
| 28 | index 85b922dab8..04cc377040 100644 | ||
| 27 | --- a/io/bits/fcntl2.h | 29 | --- a/io/bits/fcntl2.h |
| 28 | +++ b/io/bits/fcntl2.h | 30 | +++ b/io/bits/fcntl2.h |
| 29 | @@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const | 31 | @@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const char *__path, int __oflag), |
| 30 | extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), | 32 | extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), |
| 31 | open64) __nonnull ((1)); | 33 | open64) __nonnull ((1)); |
| 32 | #endif | 34 | #endif |
| @@ -59,7 +61,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 59 | 61 | ||
| 60 | __fortify_function int | 62 | __fortify_function int |
| 61 | open (const char *__path, int __oflag, ...) | 63 | open (const char *__path, int __oflag, ...) |
| 62 | @@ -58,16 +76,37 @@ open (const char *__path, int __oflag, . | 64 | @@ -58,16 +76,37 @@ open (const char *__path, int __oflag, ...) |
| 63 | 65 | ||
| 64 | return __open_alias (__path, __oflag, __va_arg_pack ()); | 66 | return __open_alias (__path, __oflag, __va_arg_pack ()); |
| 65 | } | 67 | } |
| @@ -101,7 +103,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 101 | 103 | ||
| 102 | __fortify_function int | 104 | __fortify_function int |
| 103 | open64 (const char *__path, int __oflag, ...) | 105 | open64 (const char *__path, int __oflag, ...) |
| 104 | @@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag, | 106 | @@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag, ...) |
| 105 | 107 | ||
| 106 | return __open64_alias (__path, __oflag, __va_arg_pack ()); | 108 | return __open64_alias (__path, __oflag, __va_arg_pack ()); |
| 107 | } | 109 | } |
| @@ -111,7 +113,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 111 | #endif | 113 | #endif |
| 112 | 114 | ||
| 113 | 115 | ||
| 114 | @@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, ( | 116 | @@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, |
| 115 | int __oflag, ...), openat64) | 117 | int __oflag, ...), openat64) |
| 116 | __nonnull ((2)); | 118 | __nonnull ((2)); |
| 117 | # endif | 119 | # endif |
| @@ -148,7 +150,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 148 | 150 | ||
| 149 | __fortify_function int | 151 | __fortify_function int |
| 150 | openat (int __fd, const char *__path, int __oflag, ...) | 152 | openat (int __fd, const char *__path, int __oflag, ...) |
| 151 | @@ -134,6 +198,9 @@ openat (int __fd, const char *__path, in | 153 | @@ -134,6 +198,9 @@ openat (int __fd, const char *__path, int __oflag, ...) |
| 152 | 154 | ||
| 153 | return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); | 155 | return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); |
| 154 | } | 156 | } |
| @@ -158,7 +160,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 158 | 160 | ||
| 159 | 161 | ||
| 160 | # ifdef __USE_LARGEFILE64 | 162 | # ifdef __USE_LARGEFILE64 |
| 161 | @@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const | 163 | @@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const char *__path, int __oflag) |
| 162 | extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path, | 164 | extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path, |
| 163 | int __oflag, ...), openat64) | 165 | int __oflag, ...), openat64) |
| 164 | __nonnull ((2)); | 166 | __nonnull ((2)); |
| @@ -197,7 +199,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 197 | __fortify_function int | 199 | __fortify_function int |
| 198 | openat64 (int __fd, const char *__path, int __oflag, ...) | 200 | openat64 (int __fd, const char *__path, int __oflag, ...) |
| 199 | { | 201 | { |
| 200 | @@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path, | 202 | @@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path, int __oflag, ...) |
| 201 | 203 | ||
| 202 | return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); | 204 | return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); |
| 203 | } | 205 | } |
| @@ -206,9 +208,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 206 | +# undef __warn_openat64_missing_mode | 208 | +# undef __warn_openat64_missing_mode |
| 207 | # endif | 209 | # endif |
| 208 | #endif | 210 | #endif |
| 211 | diff --git a/io/bits/poll2.h b/io/bits/poll2.h | ||
| 212 | index dca49717db..cc149711af 100644 | ||
| 209 | --- a/io/bits/poll2.h | 213 | --- a/io/bits/poll2.h |
| 210 | +++ b/io/bits/poll2.h | 214 | +++ b/io/bits/poll2.h |
| 211 | @@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (st | 215 | @@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, |
| 212 | int __timeout), poll); | 216 | int __timeout), poll); |
| 213 | extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, | 217 | extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, |
| 214 | __SIZE_TYPE__ __fdslen); | 218 | __SIZE_TYPE__ __fdslen); |
| @@ -244,7 +248,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 244 | 248 | ||
| 245 | #ifdef __USE_GNU | 249 | #ifdef __USE_GNU |
| 246 | extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, | 250 | extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, |
| 247 | @@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (s | 251 | @@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, |
| 248 | extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, | 252 | extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, |
| 249 | const struct timespec *__timeout, | 253 | const struct timespec *__timeout, |
| 250 | const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); | 254 | const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); |
| @@ -284,9 +288,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 284 | #endif | 288 | #endif |
| 285 | 289 | ||
| 286 | __END_DECLS | 290 | __END_DECLS |
| 291 | diff --git a/io/fcntl.h b/io/fcntl.h | ||
| 292 | index 21b60c264d..83f2c8e117 100644 | ||
| 287 | --- a/io/fcntl.h | 293 | --- a/io/fcntl.h |
| 288 | +++ b/io/fcntl.h | 294 | +++ b/io/fcntl.h |
| 289 | @@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd, | 295 | @@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len); |
| 290 | 296 | ||
| 291 | /* Define some inlines helping to catch common problems. */ | 297 | /* Define some inlines helping to catch common problems. */ |
| 292 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ | 298 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ |
| @@ -295,18 +301,17 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 295 | # include <bits/fcntl2.h> | 301 | # include <bits/fcntl2.h> |
| 296 | #endif | 302 | #endif |
| 297 | 303 | ||
| 304 | diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h | ||
| 305 | index 60bc81735e..1338f418ba 100644 | ||
| 298 | --- a/libio/bits/stdio2.h | 306 | --- a/libio/bits/stdio2.h |
| 299 | +++ b/libio/bits/stdio2.h | 307 | +++ b/libio/bits/stdio2.h |
| 300 | @@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restr | 308 | @@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, |
| 301 | const char *__restrict __format, | 309 | const char *__restrict __format, |
| 302 | __gnuc_va_list __ap) __THROW; | 310 | __gnuc_va_list __ap) __THROW; |
| 303 | 311 | ||
| 304 | -#ifdef __va_arg_pack | 312 | -#ifdef __va_arg_pack |
| 305 | -__fortify_function int | 313 | -__fortify_function int |
| 306 | -__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) | 314 | -__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) |
| 307 | -{ | ||
| 308 | - return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ||
| 309 | - __bos (__s), __fmt, __va_arg_pack ()); | ||
| 310 | +#define __mul_may_overflow(size, n) \ | 315 | +#define __mul_may_overflow(size, n) \ |
| 311 | + ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2))) | 316 | + ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2))) |
| 312 | + | 317 | + |
| @@ -316,7 +321,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 316 | +__fortify_potential_overload int | 321 | +__fortify_potential_overload int |
| 317 | +__NTH (sprintf (char *__restrict const __clang_pass_object_size __s, | 322 | +__NTH (sprintf (char *__restrict const __clang_pass_object_size __s, |
| 318 | + const char *__restrict __fmt, ...)) | 323 | + const char *__restrict __fmt, ...)) |
| 319 | +{ | 324 | { |
| 325 | - return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ||
| 326 | - __bos (__s), __fmt, __va_arg_pack ()); | ||
| 320 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 327 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 321 | + int __result = __FORTIFY_CALL_VA_BUILTIN (sprintf, __s, | 328 | + int __result = __FORTIFY_CALL_VA_BUILTIN (sprintf, __s, |
| 322 | + __USE_FORTIFY_LEVEL - 1, | 329 | + __USE_FORTIFY_LEVEL - 1, |
| @@ -327,7 +334,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 327 | } | 334 | } |
| 328 | #elif !defined __cplusplus | 335 | #elif !defined __cplusplus |
| 329 | # define sprintf(str, ...) \ | 336 | # define sprintf(str, ...) \ |
| 330 | @@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, co | 337 | @@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) |
| 331 | __VA_ARGS__) | 338 | __VA_ARGS__) |
| 332 | #endif | 339 | #endif |
| 333 | 340 | ||
| @@ -340,7 +347,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 340 | { | 347 | { |
| 341 | return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | 348 | return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, |
| 342 | __bos (__s), __fmt, __ap); | 349 | __bos (__s), __fmt, __ap); |
| 343 | @@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__rest | 350 | @@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, |
| 344 | size_t __slen, const char *__restrict __format, | 351 | size_t __slen, const char *__restrict __format, |
| 345 | __gnuc_va_list __ap) __THROW; | 352 | __gnuc_va_list __ap) __THROW; |
| 346 | 353 | ||
| @@ -348,9 +355,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 348 | -__fortify_function int | 355 | -__fortify_function int |
| 349 | -__NTH (snprintf (char *__restrict __s, size_t __n, | 356 | -__NTH (snprintf (char *__restrict __s, size_t __n, |
| 350 | - const char *__restrict __fmt, ...)) | 357 | - const char *__restrict __fmt, ...)) |
| 351 | -{ | ||
| 352 | - return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ||
| 353 | - __bos (__s), __fmt, __va_arg_pack ()); | ||
| 354 | +# ifdef __FORTIFY_ARG_PACK_OK | 358 | +# ifdef __FORTIFY_ARG_PACK_OK |
| 355 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 4))) int | 359 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 4))) int |
| 356 | +__NTH (snprintf (char *__restrict const __clang_pass_object_size __s, | 360 | +__NTH (snprintf (char *__restrict const __clang_pass_object_size __s, |
| @@ -358,7 +362,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 358 | + /* GCC's builtin will catch this, so we just need to cover clang here. */ | 362 | + /* GCC's builtin will catch this, so we just need to cover clang here. */ |
| 359 | + __clang_warning_if (__bos_static_lt (__n, __s), | 363 | + __clang_warning_if (__bos_static_lt (__n, __s), |
| 360 | + "call to snprintf may overflow the destination buffer") | 364 | + "call to snprintf may overflow the destination buffer") |
| 361 | +{ | 365 | { |
| 366 | - return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ||
| 367 | - __bos (__s), __fmt, __va_arg_pack ()); | ||
| 362 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 368 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 363 | + int __result = __FORTIFY_CALL_VA_BUILTIN (snprintf, __s, __n, | 369 | + int __result = __FORTIFY_CALL_VA_BUILTIN (snprintf, __s, __n, |
| 364 | + __USE_FORTIFY_LEVEL - 1, | 370 | + __USE_FORTIFY_LEVEL - 1, |
| @@ -369,7 +375,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 369 | } | 375 | } |
| 370 | # elif !defined __cplusplus | 376 | # elif !defined __cplusplus |
| 371 | # define snprintf(str, len, ...) \ | 377 | # define snprintf(str, len, ...) \ |
| 372 | @@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, s | 378 | @@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, size_t __n, |
| 373 | __VA_ARGS__) | 379 | __VA_ARGS__) |
| 374 | # endif | 380 | # endif |
| 375 | 381 | ||
| @@ -385,38 +391,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 385 | { | 391 | { |
| 386 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | 392 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, |
| 387 | __bos (__s), __fmt, __ap); | 393 | __bos (__s), __fmt, __ap); |
| 388 | @@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restr | 394 | @@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, |
| 389 | extern int __vprintf_chk (int __flag, const char *__restrict __format, | 395 | extern int __vprintf_chk (int __flag, const char *__restrict __format, |
| 390 | __gnuc_va_list __ap); | 396 | __gnuc_va_list __ap); |
| 391 | 397 | ||
| 392 | -# ifdef __va_arg_pack | 398 | -# ifdef __va_arg_pack |
| 393 | -__fortify_function int | 399 | -__fortify_function int |
| 394 | -fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | 400 | -fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) |
| 395 | -{ | ||
| 396 | - return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 397 | - __va_arg_pack ()); | ||
| 398 | -} | ||
| 399 | - | ||
| 400 | -__fortify_function int | ||
| 401 | -printf (const char *__restrict __fmt, ...) | ||
| 402 | -{ | ||
| 403 | - return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ||
| 404 | +# ifdef __FORTIFY_ARG_PACK_OK | 401 | +# ifdef __FORTIFY_ARG_PACK_OK |
| 405 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int | 402 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int |
| 406 | +fprintf (FILE *__restrict const __clang_pass_object_size __stream, | 403 | +fprintf (FILE *__restrict const __clang_pass_object_size __stream, |
| 407 | + const char *__restrict __fmt, ...) | 404 | + const char *__restrict __fmt, ...) |
| 408 | +{ | 405 | { |
| 406 | - return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 407 | - __va_arg_pack ()); | ||
| 409 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 408 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 410 | + int __result = __FORTIFY_CALL_VA_CHK (fprintf, __stream, | 409 | + int __result = __FORTIFY_CALL_VA_CHK (fprintf, __stream, |
| 411 | + __USE_FORTIFY_LEVEL - 1, __fmt, | 410 | + __USE_FORTIFY_LEVEL - 1, __fmt, |
| 412 | + __FORTIFY_ARG_PACK); | 411 | + __FORTIFY_ARG_PACK); |
| 413 | + __FORTIFY_FREE_ARG_PACK(); | 412 | + __FORTIFY_FREE_ARG_PACK(); |
| 414 | + return __result; | 413 | + return __result; |
| 415 | +} | 414 | } |
| 416 | + | 415 | |
| 416 | -__fortify_function int | ||
| 417 | -printf (const char *__restrict __fmt, ...) | ||
| 417 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 2))) int | 418 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 2))) int |
| 418 | +printf (const char *__restrict const __clang_pass_object_size __fmt, ...) | 419 | +printf (const char *__restrict const __clang_pass_object_size __fmt, ...) |
| 419 | +{ | 420 | { |
| 421 | - return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ||
| 420 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 422 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 421 | + int __result = __FORTIFY_CALL_VA_CHK (printf, __USE_FORTIFY_LEVEL - 1, __fmt, | 423 | + int __result = __FORTIFY_CALL_VA_CHK (printf, __USE_FORTIFY_LEVEL - 1, __fmt, |
| 422 | + __FORTIFY_ARG_PACK); | 424 | + __FORTIFY_ARG_PACK); |
| @@ -425,7 +427,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 425 | } | 427 | } |
| 426 | # elif !defined __cplusplus | 428 | # elif !defined __cplusplus |
| 427 | # define printf(...) \ | 429 | # define printf(...) \ |
| 428 | @@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, .. | 430 | @@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, ...) |
| 429 | __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) | 431 | __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) |
| 430 | # endif | 432 | # endif |
| 431 | 433 | ||
| @@ -437,7 +439,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 437 | { | 439 | { |
| 438 | #ifdef __USE_EXTERN_INLINES | 440 | #ifdef __USE_EXTERN_INLINES |
| 439 | return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 441 | return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 440 | @@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, _ | 442 | @@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __ap) |
| 441 | return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 443 | return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 442 | #endif | 444 | #endif |
| 443 | } | 445 | } |
| @@ -449,21 +451,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 449 | const char *__restrict __fmt, __gnuc_va_list __ap) | 451 | const char *__restrict __fmt, __gnuc_va_list __ap) |
| 450 | { | 452 | { |
| 451 | return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 453 | return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 452 | @@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int | 454 | @@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int __flag, |
| 453 | const char *__restrict __fmt, __gnuc_va_list __arg) | 455 | const char *__restrict __fmt, __gnuc_va_list __arg) |
| 454 | __attribute__ ((__format__ (__printf__, 3, 0))); | 456 | __attribute__ ((__format__ (__printf__, 3, 0))); |
| 455 | 457 | ||
| 456 | -# ifdef __va_arg_pack | 458 | -# ifdef __va_arg_pack |
| 457 | -__fortify_function int | 459 | -__fortify_function int |
| 458 | -dprintf (int __fd, const char *__restrict __fmt, ...) | 460 | -dprintf (int __fd, const char *__restrict __fmt, ...) |
| 459 | -{ | ||
| 460 | - return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 461 | - __va_arg_pack ()); | ||
| 462 | +# ifdef __FORTIFY_ARG_PACK_OK | 461 | +# ifdef __FORTIFY_ARG_PACK_OK |
| 463 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int | 462 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int |
| 464 | +dprintf (int __fd, const char *__restrict const __clang_pass_object_size __fmt, | 463 | +dprintf (int __fd, const char *__restrict const __clang_pass_object_size __fmt, |
| 465 | + ...) | 464 | + ...) |
| 466 | +{ | 465 | { |
| 466 | - return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 467 | - __va_arg_pack ()); | ||
| 467 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 468 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 468 | + int __result = __FORTIFY_CALL_VA_CHK (dprintf, __fd, __USE_FORTIFY_LEVEL - 1, | 469 | + int __result = __FORTIFY_CALL_VA_CHK (dprintf, __fd, __USE_FORTIFY_LEVEL - 1, |
| 469 | + __fmt, __FORTIFY_ARG_PACK); | 470 | + __fmt, __FORTIFY_ARG_PACK); |
| @@ -484,21 +485,13 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 484 | { | 485 | { |
| 485 | return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 486 | return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 486 | } | 487 | } |
| 487 | @@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct | 488 | @@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, |
| 488 | __gnuc_va_list __args) | 489 | __gnuc_va_list __args) |
| 489 | __THROW __attribute__ ((__format__ (__printf__, 3, 0))); | 490 | __THROW __attribute__ ((__format__ (__printf__, 3, 0))); |
| 490 | 491 | ||
| 491 | -# ifdef __va_arg_pack | 492 | -# ifdef __va_arg_pack |
| 492 | -__fortify_function int | 493 | -__fortify_function int |
| 493 | -__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) | 494 | -__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) |
| 494 | -{ | ||
| 495 | - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 496 | - __va_arg_pack ()); | ||
| 497 | -} | ||
| 498 | - | ||
| 499 | -__fortify_function int | ||
| 500 | -__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt, | ||
| 501 | - ...)) | ||
| 502 | +# ifdef __FORTIFY_ARG_PACK_OK | 495 | +# ifdef __FORTIFY_ARG_PACK_OK |
| 503 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) | 496 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) |
| 504 | +__wur int | 497 | +__wur int |
| @@ -507,31 +500,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 507 | { | 500 | { |
| 508 | - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, | 501 | - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, |
| 509 | - __va_arg_pack ()); | 502 | - __va_arg_pack ()); |
| 510 | -} | ||
| 511 | - | ||
| 512 | -__fortify_function int | ||
| 513 | -__NTH (obstack_printf (struct obstack *__restrict __obstack, | ||
| 514 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 503 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 515 | + int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr, | 504 | + int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr, |
| 516 | + __USE_FORTIFY_LEVEL - 1, __fmt, | 505 | + __USE_FORTIFY_LEVEL - 1, __fmt, |
| 517 | + __FORTIFY_ARG_PACK); | 506 | + __FORTIFY_ARG_PACK); |
| 518 | + __FORTIFY_FREE_ARG_PACK(); | 507 | + __FORTIFY_FREE_ARG_PACK(); |
| 519 | + return __result; | 508 | + return __result; |
| 520 | +} | 509 | } |
| 521 | + | 510 | |
| 511 | -__fortify_function int | ||
| 512 | -__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt, | ||
| 513 | - ...)) | ||
| 522 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) | 514 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) |
| 523 | +__wur int | 515 | +__wur int |
| 524 | +__NTH (__asprintf (char **__restrict const __clang_pass_object_size __ptr, | 516 | +__NTH (__asprintf (char **__restrict const __clang_pass_object_size __ptr, |
| 525 | + const char *__restrict __fmt, ...)) | 517 | + const char *__restrict __fmt, ...)) |
| 526 | +{ | 518 | { |
| 519 | - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 520 | - __va_arg_pack ()); | ||
| 527 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 521 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 528 | + int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr, | 522 | + int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr, |
| 529 | + __USE_FORTIFY_LEVEL - 1, __fmt, | 523 | + __USE_FORTIFY_LEVEL - 1, __fmt, |
| 530 | + __FORTIFY_ARG_PACK); | 524 | + __FORTIFY_ARG_PACK); |
| 531 | + __FORTIFY_FREE_ARG_PACK(); | 525 | + __FORTIFY_FREE_ARG_PACK(); |
| 532 | + return __result; | 526 | + return __result; |
| 533 | +} | 527 | } |
| 534 | + | 528 | |
| 529 | -__fortify_function int | ||
| 530 | -__NTH (obstack_printf (struct obstack *__restrict __obstack, | ||
| 535 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int | 531 | +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int |
| 536 | +__NTH (obstack_printf (struct obstack * | 532 | +__NTH (obstack_printf (struct obstack * |
| 537 | + __restrict const __clang_pass_object_size __obstack, | 533 | + __restrict const __clang_pass_object_size __obstack, |
| @@ -553,7 +549,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 553 | } | 549 | } |
| 554 | # elif !defined __cplusplus | 550 | # elif !defined __cplusplus |
| 555 | # define asprintf(ptr, ...) \ | 551 | # define asprintf(ptr, ...) \ |
| 556 | @@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *_ | 552 | @@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack, |
| 557 | __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) | 553 | __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) |
| 558 | # endif | 554 | # endif |
| 559 | 555 | ||
| @@ -576,17 +572,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 576 | const char *__restrict __fmt, __gnuc_va_list __ap)) | 572 | const char *__restrict __fmt, __gnuc_va_list __ap)) |
| 577 | { | 573 | { |
| 578 | return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, | 574 | return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, |
| 579 | @@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack * | 575 | @@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack *__restrict __obstack, |
| 580 | 576 | ||
| 581 | #if __GLIBC_USE (DEPRECATED_GETS) | 577 | #if __GLIBC_USE (DEPRECATED_GETS) |
| 582 | extern char *__gets_chk (char *__str, size_t) __wur; | 578 | extern char *__gets_chk (char *__str, size_t) __wur; |
| 583 | -extern char *__REDIRECT (__gets_warn, (char *__str), gets) | 579 | -extern char *__REDIRECT (__gets_warn, (char *__str), gets) |
| 584 | - __wur __warnattr ("please use fgets or getline instead, gets can't " | 580 | - __wur __warnattr ("please use fgets or getline instead, gets can't " |
| 585 | - "specify buffer size"); | 581 | - "specify buffer size"); |
| 586 | +extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur; | 582 | - |
| 587 | |||
| 588 | -__fortify_function __wur char * | 583 | -__fortify_function __wur char * |
| 589 | -gets (char *__str) | 584 | -gets (char *__str) |
| 585 | +extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur; | ||
| 586 | + | ||
| 590 | +__fortify_potential_overload __wur char * | 587 | +__fortify_potential_overload __wur char * |
| 591 | +gets (char *const __clang_pass_object_size __str) | 588 | +gets (char *const __clang_pass_object_size __str) |
| 592 | +__FORTIFY_PRECONDITIONS | 589 | +__FORTIFY_PRECONDITIONS |
| @@ -603,7 +600,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 603 | #endif | 600 | #endif |
| 604 | 601 | ||
| 605 | extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, | 602 | extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, |
| 606 | @@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restri | 603 | @@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, |
| 607 | extern char *__REDIRECT (__fgets_alias, | 604 | extern char *__REDIRECT (__fgets_alias, |
| 608 | (char *__restrict __s, int __n, | 605 | (char *__restrict __s, int __n, |
| 609 | FILE *__restrict __stream), fgets) __wur; | 606 | FILE *__restrict __stream), fgets) __wur; |
| @@ -612,9 +609,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 612 | - FILE *__restrict __stream), __fgets_chk) | 609 | - FILE *__restrict __stream), __fgets_chk) |
| 613 | - __wur __warnattr ("fgets called with bigger size than length " | 610 | - __wur __warnattr ("fgets called with bigger size than length " |
| 614 | - "of destination buffer"); | 611 | - "of destination buffer"); |
| 615 | 612 | - | |
| 616 | -__fortify_function __wur char * | 613 | -__fortify_function __wur char * |
| 617 | -fgets (char *__restrict __s, int __n, FILE *__restrict __stream) | 614 | -fgets (char *__restrict __s, int __n, FILE *__restrict __stream) |
| 615 | + | ||
| 618 | +__fortify_potential_overload __wur char * | 616 | +__fortify_potential_overload __wur char * |
| 619 | +fgets (char *__restrict const __clang_pass_object_size __s, int __n, | 617 | +fgets (char *__restrict const __clang_pass_object_size __s, int __n, |
| 620 | + FILE *__restrict __stream) | 618 | + FILE *__restrict __stream) |
| @@ -679,7 +677,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 679 | 677 | ||
| 680 | #ifdef __USE_GNU | 678 | #ifdef __USE_GNU |
| 681 | extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, | 679 | extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, |
| 682 | @@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char | 680 | @@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, |
| 683 | extern char *__REDIRECT (__fgets_unlocked_alias, | 681 | extern char *__REDIRECT (__fgets_unlocked_alias, |
| 684 | (char *__restrict __s, int __n, | 682 | (char *__restrict __s, int __n, |
| 685 | FILE *__restrict __stream), fgets_unlocked) __wur; | 683 | FILE *__restrict __stream), fgets_unlocked) __wur; |
| @@ -688,9 +686,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 688 | - FILE *__restrict __stream), __fgets_unlocked_chk) | 686 | - FILE *__restrict __stream), __fgets_unlocked_chk) |
| 689 | - __wur __warnattr ("fgets_unlocked called with bigger size than length " | 687 | - __wur __warnattr ("fgets_unlocked called with bigger size than length " |
| 690 | - "of destination buffer"); | 688 | - "of destination buffer"); |
| 691 | 689 | - | |
| 692 | -__fortify_function __wur char * | 690 | -__fortify_function __wur char * |
| 693 | -fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) | 691 | -fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) |
| 692 | + | ||
| 694 | +__fortify_potential_overload __wur char * | 693 | +__fortify_potential_overload __wur char * |
| 695 | +fgets_unlocked (char *__restrict const __clang_pass_object_size __s, int __n, | 694 | +fgets_unlocked (char *__restrict const __clang_pass_object_size __s, int __n, |
| 696 | + FILE *__restrict __stream) | 695 | + FILE *__restrict __stream) |
| @@ -715,7 +714,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 715 | #endif | 714 | #endif |
| 716 | 715 | ||
| 717 | #ifdef __USE_MISC | 716 | #ifdef __USE_MISC |
| 718 | @@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlock | 717 | @@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlocked_alias, |
| 719 | (void *__restrict __ptr, size_t __size, | 718 | (void *__restrict __ptr, size_t __size, |
| 720 | size_t __n, FILE *__restrict __stream), | 719 | size_t __n, FILE *__restrict __stream), |
| 721 | fread_unlocked) __wur; | 720 | fread_unlocked) __wur; |
| @@ -756,7 +755,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 756 | 755 | ||
| 757 | # ifdef __USE_EXTERN_INLINES | 756 | # ifdef __USE_EXTERN_INLINES |
| 758 | if (__builtin_constant_p (__size) | 757 | if (__builtin_constant_p (__size) |
| 759 | @@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr, | 758 | @@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, |
| 760 | # endif | 759 | # endif |
| 761 | return __fread_unlocked_alias (__ptr, __size, __n, __stream); | 760 | return __fread_unlocked_alias (__ptr, __size, __n, __stream); |
| 762 | } | 761 | } |
| @@ -765,6 +764,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 765 | - | 764 | - |
| 766 | +#undef __mul_may_overflow | 765 | +#undef __mul_may_overflow |
| 767 | #endif /* bits/stdio2.h. */ | 766 | #endif /* bits/stdio2.h. */ |
| 767 | diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h | ||
| 768 | index 322192df21..68b90a5cb8 100644 | ||
| 768 | --- a/misc/bits/syslog.h | 769 | --- a/misc/bits/syslog.h |
| 769 | +++ b/misc/bits/syslog.h | 770 | +++ b/misc/bits/syslog.h |
| 770 | @@ -20,11 +20,34 @@ | 771 | @@ -20,11 +20,34 @@ |
| @@ -803,7 +804,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 803 | __fortify_function void | 804 | __fortify_function void |
| 804 | syslog (int __pri, const char *__fmt, ...) | 805 | syslog (int __pri, const char *__fmt, ...) |
| 805 | { | 806 | { |
| 806 | @@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, .. | 807 | @@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, ...) |
| 807 | # define syslog(pri, ...) \ | 808 | # define syslog(pri, ...) \ |
| 808 | __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) | 809 | __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) |
| 809 | #endif | 810 | #endif |
| @@ -820,6 +821,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 820 | - __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 821 | - __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 821 | -} | 822 | -} |
| 822 | -#endif | 823 | -#endif |
| 824 | diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h | ||
| 825 | index ff7144f3f3..a42ffd5d36 100644 | ||
| 823 | --- a/misc/sys/cdefs.h | 826 | --- a/misc/sys/cdefs.h |
| 824 | +++ b/misc/sys/cdefs.h | 827 | +++ b/misc/sys/cdefs.h |
| 825 | @@ -118,11 +118,150 @@ | 828 | @@ -118,11 +118,150 @@ |
| @@ -1004,9 +1007,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1004 | /* It is possible to compile containing GCC extensions even if GCC is | 1007 | /* It is possible to compile containing GCC extensions even if GCC is |
| 1005 | run in pedantic mode if the uses are carefully marked using the | 1008 | run in pedantic mode if the uses are carefully marked using the |
| 1006 | `__extension__' keyword. But this is not generally available before | 1009 | `__extension__' keyword. But this is not generally available before |
| 1010 | diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h | ||
| 1011 | index b8a8211d83..895d87832e 100644 | ||
| 1007 | --- a/posix/bits/unistd.h | 1012 | --- a/posix/bits/unistd.h |
| 1008 | +++ b/posix/bits/unistd.h | 1013 | +++ b/posix/bits/unistd.h |
| 1009 | @@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, voi | 1014 | @@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, |
| 1010 | size_t __buflen) __wur; | 1015 | size_t __buflen) __wur; |
| 1011 | extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, | 1016 | extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, |
| 1012 | size_t __nbytes), read) __wur; | 1017 | size_t __nbytes), read) __wur; |
| @@ -1015,10 +1020,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1015 | - size_t __buflen), __read_chk) | 1020 | - size_t __buflen), __read_chk) |
| 1016 | - __wur __warnattr ("read called with bigger length than size of " | 1021 | - __wur __warnattr ("read called with bigger length than size of " |
| 1017 | - "the destination buffer"); | 1022 | - "the destination buffer"); |
| 1018 | - | 1023 | |
| 1019 | -__fortify_function __wur ssize_t | 1024 | -__fortify_function __wur ssize_t |
| 1020 | -read (int __fd, void *__buf, size_t __nbytes) | 1025 | -read (int __fd, void *__buf, size_t __nbytes) |
| 1021 | -{ | 1026 | +__fortify_potential_overload __wur ssize_t |
| 1027 | +read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes) | ||
| 1028 | +__FORTIFY_PRECONDITIONS | ||
| 1029 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf, | ||
| 1030 | + "read called with bigger length than " | ||
| 1031 | + "size of the destination buffer") | ||
| 1032 | { | ||
| 1022 | - if (__bos0 (__buf) != (size_t) -1) | 1033 | - if (__bos0 (__buf) != (size_t) -1) |
| 1023 | - { | 1034 | - { |
| 1024 | - if (!__builtin_constant_p (__nbytes)) | 1035 | - if (!__builtin_constant_p (__nbytes)) |
| @@ -1027,14 +1038,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1027 | - if (__nbytes > __bos0 (__buf)) | 1038 | - if (__nbytes > __bos0 (__buf)) |
| 1028 | - return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); | 1039 | - return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); |
| 1029 | - } | 1040 | - } |
| 1030 | + | ||
| 1031 | +__fortify_potential_overload __wur ssize_t | ||
| 1032 | +read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes) | ||
| 1033 | +__FORTIFY_PRECONDITIONS | ||
| 1034 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf, | ||
| 1035 | + "read called with bigger length than " | ||
| 1036 | + "size of the destination buffer") | ||
| 1037 | +{ | ||
| 1038 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) | 1041 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) |
| 1039 | + return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); | 1042 | + return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); |
| 1040 | return __read_alias (__fd, __buf, __nbytes); | 1043 | return __read_alias (__fd, __buf, __nbytes); |
| @@ -1043,7 +1046,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1043 | 1046 | ||
| 1044 | #ifdef __USE_UNIX98 | 1047 | #ifdef __USE_UNIX98 |
| 1045 | extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes, | 1048 | extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes, |
| 1046 | @@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias | 1049 | @@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias, |
| 1047 | extern ssize_t __REDIRECT (__pread64_alias, | 1050 | extern ssize_t __REDIRECT (__pread64_alias, |
| 1048 | (int __fd, void *__buf, size_t __nbytes, | 1051 | (int __fd, void *__buf, size_t __nbytes, |
| 1049 | __off64_t __offset), pread64) __wur; | 1052 | __off64_t __offset), pread64) __wur; |
| @@ -1098,6 +1101,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1098 | +# define __fo_off_t __off64_t | 1101 | +# define __fo_off_t __off64_t |
| 1099 | # endif | 1102 | # endif |
| 1100 | 1103 | ||
| 1104 | -# ifdef __USE_LARGEFILE64 | ||
| 1105 | -__fortify_function __wur ssize_t | ||
| 1106 | -pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) | ||
| 1101 | +__fortify_potential_overload __wur ssize_t | 1107 | +__fortify_potential_overload __wur ssize_t |
| 1102 | +pread (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes, | 1108 | +pread (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes, |
| 1103 | + __fo_off_t __offset) | 1109 | + __fo_off_t __offset) |
| @@ -1105,20 +1111,26 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1105 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread_chk_warn, __nbytes, __buf, | 1111 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread_chk_warn, __nbytes, __buf, |
| 1106 | + "pread called with bigger length than " | 1112 | + "pread called with bigger length than " |
| 1107 | + "size of the destination buffer") | 1113 | + "size of the destination buffer") |
| 1108 | +{ | 1114 | { |
| 1115 | - if (__bos0 (__buf) != (size_t) -1) | ||
| 1116 | - { | ||
| 1117 | - if (!__builtin_constant_p (__nbytes)) | ||
| 1118 | - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); | ||
| 1109 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) | 1119 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) |
| 1110 | + return __fo_pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); | 1120 | + return __fo_pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); |
| 1111 | + return __fo_pread_alias (__fd, __buf, __nbytes, __offset); | 1121 | + return __fo_pread_alias (__fd, __buf, __nbytes, __offset); |
| 1112 | +} | 1122 | +} |
| 1113 | +__FORTIFY_FUNCTION_END | 1123 | +__FORTIFY_FUNCTION_END |
| 1114 | + | 1124 | |
| 1125 | - if ( __nbytes > __bos0 (__buf)) | ||
| 1126 | - return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, | ||
| 1127 | - __bos0 (__buf)); | ||
| 1128 | - } | ||
| 1115 | +#undef __fo_pread_chk | 1129 | +#undef __fo_pread_chk |
| 1116 | +#undef __fo_pread_alias | 1130 | +#undef __fo_pread_alias |
| 1117 | +#undef __fo_off_t | 1131 | +#undef __fo_off_t |
| 1118 | + | 1132 | |
| 1119 | # ifdef __USE_LARGEFILE64 | 1133 | +# ifdef __USE_LARGEFILE64 |
| 1120 | -__fortify_function __wur ssize_t | ||
| 1121 | -pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) | ||
| 1122 | +__fortify_potential_overload __wur ssize_t | 1134 | +__fortify_potential_overload __wur ssize_t |
| 1123 | +pread64 (int __fd, void *const __clang_pass_object_size0 __buf, | 1135 | +pread64 (int __fd, void *const __clang_pass_object_size0 __buf, |
| 1124 | + size_t __nbytes, __off64_t __offset) | 1136 | + size_t __nbytes, __off64_t __offset) |
| @@ -1126,17 +1138,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1126 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread64_warn, __nbytes, __buf, | 1138 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread64_warn, __nbytes, __buf, |
| 1127 | + "pread64 called with bigger length " | 1139 | + "pread64 called with bigger length " |
| 1128 | + "than size of the destination buffer") | 1140 | + "than size of the destination buffer") |
| 1129 | { | 1141 | +{ |
| 1130 | - if (__bos0 (__buf) != (size_t) -1) | ||
| 1131 | - { | ||
| 1132 | - if (!__builtin_constant_p (__nbytes)) | ||
| 1133 | - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); | ||
| 1134 | - | ||
| 1135 | - if ( __nbytes > __bos0 (__buf)) | ||
| 1136 | - return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, | ||
| 1137 | - __bos0 (__buf)); | ||
| 1138 | - } | ||
| 1139 | - | ||
| 1140 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) | 1142 | + if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1) |
| 1141 | + return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); | 1143 | + return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); |
| 1142 | return __pread64_alias (__fd, __buf, __nbytes, __offset); | 1144 | return __pread64_alias (__fd, __buf, __nbytes, __offset); |
| @@ -1145,7 +1147,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1145 | # endif | 1147 | # endif |
| 1146 | #endif | 1148 | #endif |
| 1147 | 1149 | ||
| 1148 | @@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlin | 1150 | @@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlink_alias, |
| 1149 | (const char *__restrict __path, | 1151 | (const char *__restrict __path, |
| 1150 | char *__restrict __buf, size_t __len), readlink) | 1152 | char *__restrict __buf, size_t __len), readlink) |
| 1151 | __nonnull ((1, 2)) __wur; | 1153 | __nonnull ((1, 2)) __wur; |
| @@ -1183,7 +1185,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1183 | #endif | 1185 | #endif |
| 1184 | 1186 | ||
| 1185 | #ifdef __USE_ATFILE | 1187 | #ifdef __USE_ATFILE |
| 1186 | @@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlin | 1188 | @@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlinkat_alias, |
| 1187 | char *__restrict __buf, size_t __len), | 1189 | char *__restrict __buf, size_t __len), |
| 1188 | readlinkat) | 1190 | readlinkat) |
| 1189 | __nonnull ((2, 3)) __wur; | 1191 | __nonnull ((2, 3)) __wur; |
| @@ -1234,24 +1236,25 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1234 | - __getcwd_chk) | 1236 | - __getcwd_chk) |
| 1235 | - __wur __warnattr ("getcwd caller with bigger length than size of " | 1237 | - __wur __warnattr ("getcwd caller with bigger length than size of " |
| 1236 | - "destination buffer"); | 1238 | - "destination buffer"); |
| 1237 | 1239 | - | |
| 1238 | -__fortify_function __wur char * | 1240 | -__fortify_function __wur char * |
| 1239 | -__NTH (getcwd (char *__buf, size_t __size)) | 1241 | -__NTH (getcwd (char *__buf, size_t __size)) |
| 1240 | +__fortify_potential_overload __wur char * | 1242 | -{ |
| 1241 | +__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size)) | ||
| 1242 | +__FORTIFY_PRECONDITIONS | ||
| 1243 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf, | ||
| 1244 | + "getcwd called with bigger length than " | ||
| 1245 | + "size of destination buffer") | ||
| 1246 | { | ||
| 1247 | - if (__bos (__buf) != (size_t) -1) | 1243 | - if (__bos (__buf) != (size_t) -1) |
| 1248 | - { | 1244 | - { |
| 1249 | - if (!__builtin_constant_p (__size)) | 1245 | - if (!__builtin_constant_p (__size)) |
| 1250 | - return __getcwd_chk (__buf, __size, __bos (__buf)); | 1246 | - return __getcwd_chk (__buf, __size, __bos (__buf)); |
| 1251 | - | 1247 | |
| 1252 | - if (__size > __bos (__buf)) | 1248 | - if (__size > __bos (__buf)) |
| 1253 | - return __getcwd_chk_warn (__buf, __size, __bos (__buf)); | 1249 | - return __getcwd_chk_warn (__buf, __size, __bos (__buf)); |
| 1254 | - } | 1250 | - } |
| 1251 | +__fortify_potential_overload __wur char * | ||
| 1252 | +__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size)) | ||
| 1253 | +__FORTIFY_PRECONDITIONS | ||
| 1254 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf, | ||
| 1255 | + "getcwd called with bigger length than " | ||
| 1256 | + "size of destination buffer") | ||
| 1257 | +{ | ||
| 1255 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) | 1258 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) |
| 1256 | + return __getcwd_chk (__buf, __size, __bos (__buf)); | 1259 | + return __getcwd_chk (__buf, __size, __bos (__buf)); |
| 1257 | return __getcwd_alias (__buf, __size); | 1260 | return __getcwd_alias (__buf, __size); |
| @@ -1268,11 +1271,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1268 | - __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd " | 1271 | - __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd " |
| 1269 | - "doesn't specify buffer size"); | 1272 | - "doesn't specify buffer size"); |
| 1270 | + __nonnull ((1)) __wur __warnattr (__warn_getwd_use_something_else); | 1273 | + __nonnull ((1)) __wur __warnattr (__warn_getwd_use_something_else); |
| 1271 | + | ||
| 1272 | +extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur; | ||
| 1273 | 1274 | ||
| 1274 | -__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * | 1275 | -__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * |
| 1275 | -__NTH (getwd (char *__buf)) | 1276 | -__NTH (getwd (char *__buf)) |
| 1277 | +extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur; | ||
| 1278 | + | ||
| 1276 | +__fortify_potential_overload __nonnull ((1)) __attribute_deprecated__ __wur | 1279 | +__fortify_potential_overload __nonnull ((1)) __attribute_deprecated__ __wur |
| 1277 | +char * | 1280 | +char * |
| 1278 | +__NTH (getwd (char *const __clang_pass_object_size __buf)) | 1281 | +__NTH (getwd (char *const __clang_pass_object_size __buf)) |
| @@ -1295,25 +1298,26 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1295 | - size_t __buflen), __confstr_chk) | 1298 | - size_t __buflen), __confstr_chk) |
| 1296 | - __warnattr ("confstr called with bigger length than size of destination " | 1299 | - __warnattr ("confstr called with bigger length than size of destination " |
| 1297 | - "buffer"); | 1300 | - "buffer"); |
| 1298 | 1301 | - | |
| 1299 | -__fortify_function size_t | 1302 | -__fortify_function size_t |
| 1300 | -__NTH (confstr (int __name, char *__buf, size_t __len)) | 1303 | -__NTH (confstr (int __name, char *__buf, size_t __len)) |
| 1301 | +__fortify_potential_overload size_t | 1304 | -{ |
| 1302 | +__NTH (confstr (int __name, char *const __clang_pass_object_size __buf, | ||
| 1303 | + size_t __len)) | ||
| 1304 | +__FORTIFY_PRECONDITIONS | ||
| 1305 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf, | ||
| 1306 | + "confstr called with bigger length than " | ||
| 1307 | + "size of destination buffer") | ||
| 1308 | { | ||
| 1309 | - if (__bos (__buf) != (size_t) -1) | 1305 | - if (__bos (__buf) != (size_t) -1) |
| 1310 | - { | 1306 | - { |
| 1311 | - if (!__builtin_constant_p (__len)) | 1307 | - if (!__builtin_constant_p (__len)) |
| 1312 | - return __confstr_chk (__name, __buf, __len, __bos (__buf)); | 1308 | - return __confstr_chk (__name, __buf, __len, __bos (__buf)); |
| 1313 | - | 1309 | |
| 1314 | - if (__bos (__buf) < __len) | 1310 | - if (__bos (__buf) < __len) |
| 1315 | - return __confstr_chk_warn (__name, __buf, __len, __bos (__buf)); | 1311 | - return __confstr_chk_warn (__name, __buf, __len, __bos (__buf)); |
| 1316 | - } | 1312 | - } |
| 1313 | +__fortify_potential_overload size_t | ||
| 1314 | +__NTH (confstr (int __name, char *const __clang_pass_object_size __buf, | ||
| 1315 | + size_t __len)) | ||
| 1316 | +__FORTIFY_PRECONDITIONS | ||
| 1317 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf, | ||
| 1318 | + "confstr called with bigger length than " | ||
| 1319 | + "size of destination buffer") | ||
| 1320 | +{ | ||
| 1317 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) | 1321 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) |
| 1318 | + return __confstr_chk (__name, __buf, __len, __bos (__buf)); | 1322 | + return __confstr_chk (__name, __buf, __len, __bos (__buf)); |
| 1319 | return __confstr_alias (__name, __buf, __len); | 1323 | return __confstr_alias (__name, __buf, __len); |
| @@ -1333,15 +1337,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1333 | - | 1337 | - |
| 1334 | -__fortify_function int | 1338 | -__fortify_function int |
| 1335 | -__NTH (getgroups (int __size, __gid_t __list[])) | 1339 | -__NTH (getgroups (int __size, __gid_t __list[])) |
| 1336 | -{ | ||
| 1337 | - if (__bos (__list) != (size_t) -1) | ||
| 1338 | - { | ||
| 1339 | - if (!__builtin_constant_p (__size) || __size < 0) | ||
| 1340 | - return __getgroups_chk (__size, __list, __bos (__list)); | ||
| 1341 | - | ||
| 1342 | - if (__size * sizeof (__gid_t) > __bos (__list)) | ||
| 1343 | - return __getgroups_chk_warn (__size, __list, __bos (__list)); | ||
| 1344 | - } | ||
| 1345 | + | 1340 | + |
| 1346 | +__fortify_potential_overload int | 1341 | +__fortify_potential_overload int |
| 1347 | +__NTH (getgroups (int __size, __gid_t *const __clang_pass_object_size __list)) | 1342 | +__NTH (getgroups (int __size, __gid_t *const __clang_pass_object_size __list)) |
| @@ -1351,7 +1346,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1351 | + "getgroups called with bigger group " | 1346 | + "getgroups called with bigger group " |
| 1352 | + "count than what can fit into " | 1347 | + "count than what can fit into " |
| 1353 | + "destination buffer") | 1348 | + "destination buffer") |
| 1354 | +{ | 1349 | { |
| 1350 | - if (__bos (__list) != (size_t) -1) | ||
| 1351 | - { | ||
| 1352 | - if (!__builtin_constant_p (__size) || __size < 0) | ||
| 1353 | - return __getgroups_chk (__size, __list, __bos (__list)); | ||
| 1354 | - | ||
| 1355 | - if (__size * sizeof (__gid_t) > __bos (__list)) | ||
| 1356 | - return __getgroups_chk_warn (__size, __list, __bos (__list)); | ||
| 1357 | - } | ||
| 1355 | + if (__FORTIFY_CALL_CHK && __bos (__list) != (size_t) -1) | 1358 | + if (__FORTIFY_CALL_CHK && __bos (__list) != (size_t) -1) |
| 1356 | + return __getgroups_chk (__size, __list, __bos (__list)); | 1359 | + return __getgroups_chk (__size, __list, __bos (__list)); |
| 1357 | return __getgroups_alias (__size, __list); | 1360 | return __getgroups_alias (__size, __list); |
| @@ -1360,13 +1363,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1360 | 1363 | ||
| 1361 | 1364 | ||
| 1362 | extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, | 1365 | extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, |
| 1363 | @@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_c | 1366 | @@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_chk_warn, |
| 1364 | __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than " | 1367 | __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than " |
| 1365 | "size of destination buffer"); | 1368 | "size of destination buffer"); |
| 1366 | 1369 | ||
| 1367 | -__fortify_function int | 1370 | -__fortify_function int |
| 1368 | -__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) | 1371 | -__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) |
| 1369 | -{ | 1372 | +__fortify_potential_overload int |
| 1373 | +__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf, | ||
| 1374 | + size_t __buflen)) | ||
| 1375 | +__FORTIFY_PRECONDITIONS | ||
| 1376 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf, | ||
| 1377 | + "ttyname_r called with bigger buflen " | ||
| 1378 | + "than size of destination buffer") | ||
| 1379 | { | ||
| 1370 | - if (__bos (__buf) != (size_t) -1) | 1380 | - if (__bos (__buf) != (size_t) -1) |
| 1371 | - { | 1381 | - { |
| 1372 | - if (!__builtin_constant_p (__buflen)) | 1382 | - if (!__builtin_constant_p (__buflen)) |
| @@ -1377,14 +1387,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1377 | - } | 1387 | - } |
| 1378 | - return __ttyname_r_alias (__fd, __buf, __buflen); | 1388 | - return __ttyname_r_alias (__fd, __buf, __buflen); |
| 1379 | -} | 1389 | -} |
| 1380 | +__fortify_potential_overload int | ||
| 1381 | +__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf, | ||
| 1382 | + size_t __buflen)) | ||
| 1383 | +__FORTIFY_PRECONDITIONS | ||
| 1384 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf, | ||
| 1385 | + "ttyname_r called with bigger buflen " | ||
| 1386 | + "than size of destination buffer") | ||
| 1387 | +{ | ||
| 1388 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) | 1390 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) |
| 1389 | + return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); | 1391 | + return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); |
| 1390 | + return __ttyname_r_alias (__fd, __buf, __buflen); | 1392 | + return __ttyname_r_alias (__fd, __buf, __buflen); |
| @@ -1393,7 +1395,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1393 | 1395 | ||
| 1394 | 1396 | ||
| 1395 | #ifdef __USE_POSIX199506 | 1397 | #ifdef __USE_POSIX199506 |
| 1396 | @@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf | 1398 | @@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal) |
| 1397 | __nonnull ((1)); | 1399 | __nonnull ((1)); |
| 1398 | extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), | 1400 | extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), |
| 1399 | getlogin_r) __nonnull ((1)); | 1401 | getlogin_r) __nonnull ((1)); |
| @@ -1428,7 +1430,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1428 | #endif | 1430 | #endif |
| 1429 | 1431 | ||
| 1430 | 1432 | ||
| 1431 | @@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__bu | 1433 | @@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal) |
| 1432 | __THROW __nonnull ((1)); | 1434 | __THROW __nonnull ((1)); |
| 1433 | extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), | 1435 | extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), |
| 1434 | gethostname) __nonnull ((1)); | 1436 | gethostname) __nonnull ((1)); |
| @@ -1464,7 +1466,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1464 | #endif | 1466 | #endif |
| 1465 | 1467 | ||
| 1466 | 1468 | ||
| 1467 | @@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__ | 1469 | @@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal) |
| 1468 | extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, | 1470 | extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, |
| 1469 | size_t __buflen), | 1471 | size_t __buflen), |
| 1470 | getdomainname) __nonnull ((1)) __wur; | 1472 | getdomainname) __nonnull ((1)) __wur; |
| @@ -1474,34 +1476,37 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1474 | - __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger " | 1476 | - __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger " |
| 1475 | - "buflen than size of destination " | 1477 | - "buflen than size of destination " |
| 1476 | - "buffer"); | 1478 | - "buffer"); |
| 1477 | 1479 | - | |
| 1478 | -__fortify_function int | 1480 | -__fortify_function int |
| 1479 | -__NTH (getdomainname (char *__buf, size_t __buflen)) | 1481 | -__NTH (getdomainname (char *__buf, size_t __buflen)) |
| 1480 | +__fortify_potential_overload int | 1482 | -{ |
| 1481 | +__NTH (getdomainname (char *const __clang_pass_object_size __buf, | ||
| 1482 | + size_t __buflen)) | ||
| 1483 | +__FORTIFY_PRECONDITIONS | ||
| 1484 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf, | ||
| 1485 | + "getdomainname called with bigger " | ||
| 1486 | + "buflen than size of destination buffer") | ||
| 1487 | { | ||
| 1488 | - if (__bos (__buf) != (size_t) -1) | 1483 | - if (__bos (__buf) != (size_t) -1) |
| 1489 | - { | 1484 | - { |
| 1490 | - if (!__builtin_constant_p (__buflen)) | 1485 | - if (!__builtin_constant_p (__buflen)) |
| 1491 | - return __getdomainname_chk (__buf, __buflen, __bos (__buf)); | 1486 | - return __getdomainname_chk (__buf, __buflen, __bos (__buf)); |
| 1492 | - | 1487 | |
| 1493 | - if (__buflen > __bos (__buf)) | 1488 | - if (__buflen > __bos (__buf)) |
| 1494 | - return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf)); | 1489 | - return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf)); |
| 1495 | - } | 1490 | - } |
| 1491 | +__fortify_potential_overload int | ||
| 1492 | +__NTH (getdomainname (char *const __clang_pass_object_size __buf, | ||
| 1493 | + size_t __buflen)) | ||
| 1494 | +__FORTIFY_PRECONDITIONS | ||
| 1495 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf, | ||
| 1496 | + "getdomainname called with bigger " | ||
| 1497 | + "buflen than size of destination buffer") | ||
| 1498 | +{ | ||
| 1496 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) | 1499 | + if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1) |
| 1497 | + return __getdomainname_chk (__buf, __buflen, __bos (__buf)); | 1500 | + return __getdomainname_chk (__buf, __buflen, __bos (__buf)); |
| 1498 | return __getdomainname_alias (__buf, __buflen); | 1501 | return __getdomainname_alias (__buf, __buflen); |
| 1499 | } | 1502 | } |
| 1500 | +__FORTIFY_FUNCTION_END | 1503 | +__FORTIFY_FUNCTION_END |
| 1501 | #endif | 1504 | #endif |
| 1505 | diff --git a/rt/bits/mqueue2.h b/rt/bits/mqueue2.h | ||
| 1506 | index 354f0d53bf..388b63a4f8 100644 | ||
| 1502 | --- a/rt/bits/mqueue2.h | 1507 | --- a/rt/bits/mqueue2.h |
| 1503 | +++ b/rt/bits/mqueue2.h | 1508 | +++ b/rt/bits/mqueue2.h |
| 1504 | @@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__ | 1509 | @@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__name, int __oflag) |
| 1505 | extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name, | 1510 | extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name, |
| 1506 | int __oflag, ...), mq_open) | 1511 | int __oflag, ...), mq_open) |
| 1507 | __nonnull ((1)); | 1512 | __nonnull ((1)); |
| @@ -1551,16 +1556,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1551 | 1556 | ||
| 1552 | __fortify_function mqd_t | 1557 | __fortify_function mqd_t |
| 1553 | __NTH (mq_open (const char *__name, int __oflag, ...)) | 1558 | __NTH (mq_open (const char *__name, int __oflag, ...)) |
| 1554 | @@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int | 1559 | @@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int __oflag, ...)) |
| 1555 | 1560 | ||
| 1556 | return __mq_open_alias (__name, __oflag, __va_arg_pack ()); | 1561 | return __mq_open_alias (__name, __oflag, __va_arg_pack ()); |
| 1557 | } | 1562 | } |
| 1558 | +#endif | 1563 | +#endif |
| 1559 | +#undef __warn_mq_open_wrong_number_of_args | 1564 | +#undef __warn_mq_open_wrong_number_of_args |
| 1560 | +#undef __warn_mq_open_missing_mode_and_attr | 1565 | +#undef __warn_mq_open_missing_mode_and_attr |
| 1566 | diff --git a/rt/mqueue.h b/rt/mqueue.h | ||
| 1567 | index a2a2aa1771..5a2976d1be 100644 | ||
| 1561 | --- a/rt/mqueue.h | 1568 | --- a/rt/mqueue.h |
| 1562 | +++ b/rt/mqueue.h | 1569 | +++ b/rt/mqueue.h |
| 1563 | @@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes, | 1570 | @@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, |
| 1564 | 1571 | ||
| 1565 | /* Define some inlines helping to catch common problems. */ | 1572 | /* Define some inlines helping to catch common problems. */ |
| 1566 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ | 1573 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ |
| @@ -1569,9 +1576,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1569 | # include <bits/mqueue2.h> | 1576 | # include <bits/mqueue2.h> |
| 1570 | #endif | 1577 | #endif |
| 1571 | 1578 | ||
| 1579 | diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h | ||
| 1580 | index c0421ce244..12d2e75f57 100644 | ||
| 1572 | --- a/socket/bits/socket2.h | 1581 | --- a/socket/bits/socket2.h |
| 1573 | +++ b/socket/bits/socket2.h | 1582 | +++ b/socket/bits/socket2.h |
| 1574 | @@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, voi | 1583 | @@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, |
| 1575 | int __flags); | 1584 | int __flags); |
| 1576 | extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, | 1585 | extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, |
| 1577 | int __flags), recv); | 1586 | int __flags), recv); |
| @@ -1607,7 +1616,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1607 | 1616 | ||
| 1608 | extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, | 1617 | extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, |
| 1609 | size_t __buflen, int __flags, | 1618 | size_t __buflen, int __flags, |
| 1610 | @@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_al | 1619 | @@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_alias, |
| 1611 | (int __fd, void *__restrict __buf, size_t __n, | 1620 | (int __fd, void *__restrict __buf, size_t __n, |
| 1612 | int __flags, __SOCKADDR_ARG __addr, | 1621 | int __flags, __SOCKADDR_ARG __addr, |
| 1613 | socklen_t *__restrict __addr_len), recvfrom); | 1622 | socklen_t *__restrict __addr_len), recvfrom); |
| @@ -1646,9 +1655,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1646 | return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); | 1655 | return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); |
| 1647 | } | 1656 | } |
| 1648 | +__FORTIFY_FUNCTION_END | 1657 | +__FORTIFY_FUNCTION_END |
| 1658 | diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h | ||
| 1659 | index bfdee75073..a15f965b12 100644 | ||
| 1649 | --- a/stdlib/bits/stdlib.h | 1660 | --- a/stdlib/bits/stdlib.h |
| 1650 | +++ b/stdlib/bits/stdlib.h | 1661 | +++ b/stdlib/bits/stdlib.h |
| 1651 | @@ -26,27 +26,27 @@ extern char *__realpath_chk (const char | 1662 | @@ -26,27 +26,27 @@ extern char *__realpath_chk (const char *__restrict __name, |
| 1652 | extern char *__REDIRECT_NTH (__realpath_alias, | 1663 | extern char *__REDIRECT_NTH (__realpath_alias, |
| 1653 | (const char *__restrict __name, | 1664 | (const char *__restrict __name, |
| 1654 | char *__restrict __resolved), realpath) __wur; | 1665 | char *__restrict __resolved), realpath) __wur; |
| @@ -1691,7 +1702,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1691 | 1702 | ||
| 1692 | 1703 | ||
| 1693 | extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, | 1704 | extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, |
| 1694 | @@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, ch | 1705 | @@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, |
| 1695 | extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, | 1706 | extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, |
| 1696 | size_t __buflen), ptsname_r) | 1707 | size_t __buflen), ptsname_r) |
| 1697 | __nonnull ((2)); | 1708 | __nonnull ((2)); |
| @@ -1700,9 +1711,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1700 | - size_t __nreal), __ptsname_r_chk) | 1711 | - size_t __nreal), __ptsname_r_chk) |
| 1701 | - __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than " | 1712 | - __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than " |
| 1702 | - "size of buf"); | 1713 | - "size of buf"); |
| 1703 | 1714 | - | |
| 1704 | -__fortify_function int | 1715 | -__fortify_function int |
| 1705 | -__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) | 1716 | -__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) |
| 1717 | + | ||
| 1706 | +__fortify_potential_overload int | 1718 | +__fortify_potential_overload int |
| 1707 | +__NTH (ptsname_r (int __fd, char *const __clang_pass_object_size __buf, | 1719 | +__NTH (ptsname_r (int __fd, char *const __clang_pass_object_size __buf, |
| 1708 | + size_t __buflen)) | 1720 | + size_t __buflen)) |
| @@ -1737,7 +1749,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1737 | { | 1749 | { |
| 1738 | /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. | 1750 | /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. |
| 1739 | But this would only disturb the namespace. So we define our own | 1751 | But this would only disturb the namespace. So we define our own |
| 1740 | @@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs | 1752 | @@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs_alias, |
| 1741 | (wchar_t *__restrict __dst, | 1753 | (wchar_t *__restrict __dst, |
| 1742 | const char *__restrict __src, | 1754 | const char *__restrict __src, |
| 1743 | size_t __len), mbstowcs); | 1755 | size_t __len), mbstowcs); |
| @@ -1747,11 +1759,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1747 | - size_t __len, size_t __dstlen), __mbstowcs_chk) | 1759 | - size_t __len, size_t __dstlen), __mbstowcs_chk) |
| 1748 | - __warnattr ("mbstowcs called with dst buffer smaller than len " | 1760 | - __warnattr ("mbstowcs called with dst buffer smaller than len " |
| 1749 | - "* sizeof (wchar_t)"); | 1761 | - "* sizeof (wchar_t)"); |
| 1750 | - | 1762 | |
| 1751 | -__fortify_function size_t | 1763 | -__fortify_function size_t |
| 1752 | -__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, | 1764 | -__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, |
| 1753 | - size_t __len)) | 1765 | - size_t __len)) |
| 1754 | + | ||
| 1755 | +__fortify_potential_overload size_t | 1766 | +__fortify_potential_overload size_t |
| 1756 | +__NTH (mbstowcs (wchar_t *__restrict const __clang_pass_object_size __dst, | 1767 | +__NTH (mbstowcs (wchar_t *__restrict const __clang_pass_object_size __dst, |
| 1757 | + const char *__restrict __src, size_t __len)) | 1768 | + const char *__restrict __src, size_t __len)) |
| @@ -1780,7 +1791,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1780 | 1791 | ||
| 1781 | 1792 | ||
| 1782 | extern size_t __wcstombs_chk (char *__restrict __dst, | 1793 | extern size_t __wcstombs_chk (char *__restrict __dst, |
| 1783 | @@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs | 1794 | @@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs_alias, |
| 1784 | (char *__restrict __dst, | 1795 | (char *__restrict __dst, |
| 1785 | const wchar_t *__restrict __src, | 1796 | const wchar_t *__restrict __src, |
| 1786 | size_t __len), wcstombs); | 1797 | size_t __len), wcstombs); |
| @@ -1813,6 +1824,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1813 | return __wcstombs_alias (__dst, __src, __len); | 1824 | return __wcstombs_alias (__dst, __src, __len); |
| 1814 | } | 1825 | } |
| 1815 | +__FORTIFY_FUNCTION_END | 1826 | +__FORTIFY_FUNCTION_END |
| 1827 | diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h | ||
| 1828 | index e4d07cb50c..f73528ba7e 100644 | ||
| 1816 | --- a/string/bits/string_fortified.h | 1829 | --- a/string/bits/string_fortified.h |
| 1817 | +++ b/string/bits/string_fortified.h | 1830 | +++ b/string/bits/string_fortified.h |
| 1818 | @@ -22,45 +22,82 @@ | 1831 | @@ -22,45 +22,82 @@ |
| @@ -1827,14 +1840,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1827 | -__fortify_function void * | 1840 | -__fortify_function void * |
| 1828 | -__NTH (memcpy (void *__restrict __dest, const void *__restrict __src, | 1841 | -__NTH (memcpy (void *__restrict __dest, const void *__restrict __src, |
| 1829 | - size_t __len)) | 1842 | - size_t __len)) |
| 1830 | -{ | ||
| 1831 | - return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1832 | -} | ||
| 1833 | - | ||
| 1834 | -__fortify_function void * | ||
| 1835 | -__NTH (memmove (void *__dest, const void *__src, size_t __len)) | ||
| 1836 | -{ | ||
| 1837 | - return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1838 | +#define __warn_len_too_large \ | 1843 | +#define __warn_len_too_large \ |
| 1839 | + "function called with bigger length than the destination buffer" | 1844 | + "function called with bigger length than the destination buffer" |
| 1840 | +/* Repeat bodies here to reduce 'note's if we detect a problem. */ | 1845 | +/* Repeat bodies here to reduce 'note's if we detect a problem. */ |
| @@ -1857,19 +1862,23 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1857 | +__NTH (memcpy (void *__restrict const __clang_pass_object_size0 __dest, | 1862 | +__NTH (memcpy (void *__restrict const __clang_pass_object_size0 __dest, |
| 1858 | + const void *__restrict __src, size_t __len)) | 1863 | + const void *__restrict __src, size_t __len)) |
| 1859 | + __warn_if_dest_too_small0 (__dest, __len) | 1864 | + __warn_if_dest_too_small0 (__dest, __len) |
| 1860 | +{ | 1865 | { |
| 1866 | - return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1861 | + size_t __bos_dst = __bos0 (__dest); | 1867 | + size_t __bos_dst = __bos0 (__dest); |
| 1862 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) | 1868 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) |
| 1863 | + && __bos_dst >= __len)) | 1869 | + && __bos_dst >= __len)) |
| 1864 | + return __builtin_memcpy (__dest, __src, __len); | 1870 | + return __builtin_memcpy (__dest, __src, __len); |
| 1865 | + return __builtin___memcpy_chk (__dest, __src, __len, __bos_dst); | 1871 | + return __builtin___memcpy_chk (__dest, __src, __len, __bos_dst); |
| 1866 | +} | 1872 | } |
| 1867 | + | 1873 | |
| 1874 | -__fortify_function void * | ||
| 1875 | -__NTH (memmove (void *__dest, const void *__src, size_t __len)) | ||
| 1868 | +__fortify_potential_overload void * | 1876 | +__fortify_potential_overload void * |
| 1869 | +__NTH (memmove (void *const __clang_pass_object_size0 __dest, | 1877 | +__NTH (memmove (void *const __clang_pass_object_size0 __dest, |
| 1870 | + const void *__src, size_t __len)) | 1878 | + const void *__src, size_t __len)) |
| 1871 | + __warn_if_dest_too_small0 (__dest, __len) | 1879 | + __warn_if_dest_too_small0 (__dest, __len) |
| 1872 | +{ | 1880 | { |
| 1881 | - return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1873 | + size_t __bos_dst = __bos0 (__dest); | 1882 | + size_t __bos_dst = __bos0 (__dest); |
| 1874 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) | 1883 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) |
| 1875 | + && __bos_dst >= __len)) | 1884 | + && __bos_dst >= __len)) |
| @@ -1881,13 +1890,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1881 | -__fortify_function void * | 1890 | -__fortify_function void * |
| 1882 | -__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, | 1891 | -__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, |
| 1883 | - size_t __len)) | 1892 | - size_t __len)) |
| 1884 | -{ | ||
| 1885 | - return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1886 | +__fortify_potential_overload void * | 1893 | +__fortify_potential_overload void * |
| 1887 | +__NTH (mempcpy (void *__restrict const __clang_pass_object_size0 __dest, | 1894 | +__NTH (mempcpy (void *__restrict const __clang_pass_object_size0 __dest, |
| 1888 | + const void *__restrict __src, size_t __len)) | 1895 | + const void *__restrict __src, size_t __len)) |
| 1889 | + __warn_if_dest_too_small0 (__dest, __len) | 1896 | + __warn_if_dest_too_small0 (__dest, __len) |
| 1890 | +{ | 1897 | { |
| 1898 | - return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); | ||
| 1891 | + size_t __bos_dst = __bos0 (__dest); | 1899 | + size_t __bos_dst = __bos0 (__dest); |
| 1892 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) | 1900 | + if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len) |
| 1893 | + && __bos_dst >= __len)) | 1901 | + && __bos_dst >= __len)) |
| @@ -1923,7 +1931,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1923 | if (__builtin_constant_p (__len) && __len == 0 | 1931 | if (__builtin_constant_p (__len) && __len == 0 |
| 1924 | && (!__builtin_constant_p (__ch) || __ch != 0)) | 1932 | && (!__builtin_constant_p (__ch) || __ch != 0)) |
| 1925 | { | 1933 | { |
| 1926 | @@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, s | 1934 | @@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, size_t __len)) |
| 1927 | return __dest; | 1935 | return __dest; |
| 1928 | } | 1936 | } |
| 1929 | #endif | 1937 | #endif |
| @@ -1938,7 +1946,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1938 | 1946 | ||
| 1939 | #ifdef __USE_MISC | 1947 | #ifdef __USE_MISC |
| 1940 | # include <bits/strings_fortified.h> | 1948 | # include <bits/strings_fortified.h> |
| 1941 | @@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, siz | 1949 | @@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, size_t __len)) |
| 1942 | } | 1950 | } |
| 1943 | #endif | 1951 | #endif |
| 1944 | 1952 | ||
| @@ -1977,7 +1985,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 1977 | { | 1985 | { |
| 1978 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | 1986 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); |
| 1979 | } | 1987 | } |
| 1980 | @@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest | 1988 | @@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, |
| 1981 | extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, | 1989 | extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, |
| 1982 | size_t __n), stpncpy); | 1990 | size_t __n), stpncpy); |
| 1983 | 1991 | ||
| @@ -2025,6 +2033,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2025 | +#undef __warn_input_str_too_large | 2033 | +#undef __warn_input_str_too_large |
| 2026 | +#undef __warn_if_src_too_large | 2034 | +#undef __warn_if_src_too_large |
| 2027 | #endif /* bits/string_fortified.h */ | 2035 | #endif /* bits/string_fortified.h */ |
| 2036 | diff --git a/string/bits/strings_fortified.h b/string/bits/strings_fortified.h | ||
| 2037 | index d4091f4f69..4d0cd02612 100644 | ||
| 2028 | --- a/string/bits/strings_fortified.h | 2038 | --- a/string/bits/strings_fortified.h |
| 2029 | +++ b/string/bits/strings_fortified.h | 2039 | +++ b/string/bits/strings_fortified.h |
| 2030 | @@ -19,16 +19,40 @@ | 2040 | @@ -19,16 +19,40 @@ |
| @@ -2074,6 +2084,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2074 | +#undef __strings_size_too_small | 2084 | +#undef __strings_size_too_small |
| 2075 | +#undef __strings_warn_len_too_large | 2085 | +#undef __strings_warn_len_too_large |
| 2076 | #endif | 2086 | #endif |
| 2087 | diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h | ||
| 2088 | index 86e8e23e76..1b0718119a 100644 | ||
| 2077 | --- a/wcsmbs/bits/wchar2.h | 2089 | --- a/wcsmbs/bits/wchar2.h |
| 2078 | +++ b/wcsmbs/bits/wchar2.h | 2090 | +++ b/wcsmbs/bits/wchar2.h |
| 2079 | @@ -20,7 +20,6 @@ | 2091 | @@ -20,7 +20,6 @@ |
| @@ -2084,7 +2096,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2084 | extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1, | 2096 | extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1, |
| 2085 | const wchar_t *__restrict __s2, size_t __n, | 2097 | const wchar_t *__restrict __s2, size_t __n, |
| 2086 | size_t __ns1) __THROW; | 2098 | size_t __ns1) __THROW; |
| 2087 | @@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcp | 2099 | @@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias, |
| 2088 | (wchar_t *__restrict __s1, | 2100 | (wchar_t *__restrict __s1, |
| 2089 | const wchar_t *__restrict __s2, size_t __n), | 2101 | const wchar_t *__restrict __s2, size_t __n), |
| 2090 | wmemcpy); | 2102 | wmemcpy); |
| @@ -2098,7 +2110,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2098 | -__fortify_function wchar_t * | 2110 | -__fortify_function wchar_t * |
| 2099 | -__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, | 2111 | -__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, |
| 2100 | - size_t __n)) | 2112 | - size_t __n)) |
| 2101 | -{ | 2113 | +__fortify_potential_overload wchar_t * |
| 2114 | +__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1, | ||
| 2115 | + const wchar_t *__restrict __s2, size_t __n)) | ||
| 2116 | +__FORTIFY_PRECONDITIONS | ||
| 2117 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1, | ||
| 2118 | + sizeof (wchar_t), | ||
| 2119 | + "wmemcpy called with length bigger " | ||
| 2120 | + "than size of destination buffer") | ||
| 2121 | { | ||
| 2102 | - if (__bos0 (__s1) != (size_t) -1) | 2122 | - if (__bos0 (__s1) != (size_t) -1) |
| 2103 | - { | 2123 | - { |
| 2104 | - if (!__builtin_constant_p (__n)) | 2124 | - if (!__builtin_constant_p (__n)) |
| @@ -2110,15 +2130,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2110 | - __bos0 (__s1) / sizeof (wchar_t)); | 2130 | - __bos0 (__s1) / sizeof (wchar_t)); |
| 2111 | - } | 2131 | - } |
| 2112 | - return __wmemcpy_alias (__s1, __s2, __n); | 2132 | - return __wmemcpy_alias (__s1, __s2, __n); |
| 2113 | +__fortify_potential_overload wchar_t * | ||
| 2114 | +__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1, | ||
| 2115 | + const wchar_t *__restrict __s2, size_t __n)) | ||
| 2116 | +__FORTIFY_PRECONDITIONS | ||
| 2117 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1, | ||
| 2118 | + sizeof (wchar_t), | ||
| 2119 | + "wmemcpy called with length bigger " | ||
| 2120 | + "than size of destination buffer") | ||
| 2121 | +{ | ||
| 2122 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1) | 2133 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1) |
| 2123 | + return __wmemcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t)); | 2134 | + return __wmemcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t)); |
| 2124 | + return __wmemcpy_alias(__s1, __s2, __n); | 2135 | + return __wmemcpy_alias(__s1, __s2, __n); |
| @@ -2139,7 +2150,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2139 | - | 2150 | - |
| 2140 | -__fortify_function wchar_t * | 2151 | -__fortify_function wchar_t * |
| 2141 | -__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) | 2152 | -__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) |
| 2142 | -{ | 2153 | + |
| 2154 | +__fortify_potential_overload wchar_t * | ||
| 2155 | +__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1, | ||
| 2156 | + const wchar_t *__s2, size_t __n)) | ||
| 2157 | +__FORTIFY_PRECONDITIONS | ||
| 2158 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1, | ||
| 2159 | + sizeof (wchar_t), | ||
| 2160 | + "wmemmove called with length bigger " | ||
| 2161 | + "than size of destination buffer") | ||
| 2162 | { | ||
| 2143 | - if (__bos0 (__s1) != (size_t) -1) | 2163 | - if (__bos0 (__s1) != (size_t) -1) |
| 2144 | - { | 2164 | - { |
| 2145 | - if (!__builtin_constant_p (__n)) | 2165 | - if (!__builtin_constant_p (__n)) |
| @@ -2150,16 +2170,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2150 | - return __wmemmove_chk_warn (__s1, __s2, __n, | 2170 | - return __wmemmove_chk_warn (__s1, __s2, __n, |
| 2151 | - __bos0 (__s1) / sizeof (wchar_t)); | 2171 | - __bos0 (__s1) / sizeof (wchar_t)); |
| 2152 | - } | 2172 | - } |
| 2153 | + | ||
| 2154 | +__fortify_potential_overload wchar_t * | ||
| 2155 | +__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1, | ||
| 2156 | + const wchar_t *__s2, size_t __n)) | ||
| 2157 | +__FORTIFY_PRECONDITIONS | ||
| 2158 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1, | ||
| 2159 | + sizeof (wchar_t), | ||
| 2160 | + "wmemmove called with length bigger " | ||
| 2161 | + "than size of destination buffer") | ||
| 2162 | +{ | ||
| 2163 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t) -1) | 2173 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t) -1) |
| 2164 | + return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); | 2174 | + return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); |
| 2165 | return __wmemmove_alias (__s1, __s2, __n); | 2175 | return __wmemmove_alias (__s1, __s2, __n); |
| @@ -2168,7 +2178,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2168 | 2178 | ||
| 2169 | 2179 | ||
| 2170 | #ifdef __USE_GNU | 2180 | #ifdef __USE_GNU |
| 2171 | @@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempc | 2181 | @@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias, |
| 2172 | (wchar_t *__restrict __s1, | 2182 | (wchar_t *__restrict __s1, |
| 2173 | const wchar_t *__restrict __s2, | 2183 | const wchar_t *__restrict __s2, |
| 2174 | size_t __n), wmempcpy); | 2184 | size_t __n), wmempcpy); |
| @@ -2182,7 +2192,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2182 | -__fortify_function wchar_t * | 2192 | -__fortify_function wchar_t * |
| 2183 | -__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, | 2193 | -__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, |
| 2184 | - size_t __n)) | 2194 | - size_t __n)) |
| 2185 | -{ | 2195 | + |
| 2196 | +__fortify_potential_overload wchar_t * | ||
| 2197 | +__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1, | ||
| 2198 | + const wchar_t *__restrict __s2, size_t __n)) | ||
| 2199 | +__FORTIFY_PRECONDITIONS | ||
| 2200 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1, | ||
| 2201 | + sizeof (wchar_t), | ||
| 2202 | + "wmempcpy called with length bigger " | ||
| 2203 | + "than size of destination buffer") | ||
| 2204 | { | ||
| 2186 | - if (__bos0 (__s1) != (size_t) -1) | 2205 | - if (__bos0 (__s1) != (size_t) -1) |
| 2187 | - { | 2206 | - { |
| 2188 | - if (!__builtin_constant_p (__n)) | 2207 | - if (!__builtin_constant_p (__n)) |
| @@ -2194,16 +2213,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2194 | - __bos0 (__s1) / sizeof (wchar_t)); | 2213 | - __bos0 (__s1) / sizeof (wchar_t)); |
| 2195 | - } | 2214 | - } |
| 2196 | - return __wmempcpy_alias (__s1, __s2, __n); | 2215 | - return __wmempcpy_alias (__s1, __s2, __n); |
| 2197 | + | ||
| 2198 | +__fortify_potential_overload wchar_t * | ||
| 2199 | +__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1, | ||
| 2200 | + const wchar_t *__restrict __s2, size_t __n)) | ||
| 2201 | +__FORTIFY_PRECONDITIONS | ||
| 2202 | + __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1, | ||
| 2203 | + sizeof (wchar_t), | ||
| 2204 | + "wmempcpy called with length bigger " | ||
| 2205 | + "than size of destination buffer") | ||
| 2206 | +{ | ||
| 2207 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1) | 2216 | + if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1) |
| 2208 | + return __wmempcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t)); | 2217 | + return __wmempcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t)); |
| 2209 | + return __wmempcpy_alias(__s1, __s2, __n); | 2218 | + return __wmempcpy_alias(__s1, __s2, __n); |
| @@ -2212,7 +2221,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2212 | #endif | 2221 | #endif |
| 2213 | 2222 | ||
| 2214 | 2223 | ||
| 2215 | @@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t * | 2224 | @@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, |
| 2216 | size_t __ns) __THROW; | 2225 | size_t __ns) __THROW; |
| 2217 | extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, | 2226 | extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, |
| 2218 | size_t __n), wmemset); | 2227 | size_t __n), wmemset); |
| @@ -2224,16 +2233,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2224 | - | 2233 | - |
| 2225 | -__fortify_function wchar_t * | 2234 | -__fortify_function wchar_t * |
| 2226 | -__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) | 2235 | -__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) |
| 2227 | -{ | ||
| 2228 | - if (__bos0 (__s) != (size_t) -1) | ||
| 2229 | - { | ||
| 2230 | - if (!__builtin_constant_p (__n)) | ||
| 2231 | - return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); | ||
| 2232 | - | ||
| 2233 | - if (__n > __bos0 (__s) / sizeof (wchar_t)) | ||
| 2234 | - return __wmemset_chk_warn (__s, __c, __n, | ||
| 2235 | - __bos0 (__s) / sizeof (wchar_t)); | ||
| 2236 | - } | ||
| 2237 | + | 2236 | + |
| 2238 | +__fortify_potential_overload wchar_t * | 2237 | +__fortify_potential_overload wchar_t * |
| 2239 | +__NTH (wmemset (wchar_t *const __clang_pass_object_size0 __s, wchar_t __c, | 2238 | +__NTH (wmemset (wchar_t *const __clang_pass_object_size0 __s, wchar_t __c, |
| @@ -2243,7 +2242,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2243 | + sizeof (wchar_t), | 2242 | + sizeof (wchar_t), |
| 2244 | + "wmemset called with length bigger " | 2243 | + "wmemset called with length bigger " |
| 2245 | + "than size of destination buffer") | 2244 | + "than size of destination buffer") |
| 2246 | +{ | 2245 | { |
| 2246 | - if (__bos0 (__s) != (size_t) -1) | ||
| 2247 | - { | ||
| 2248 | - if (!__builtin_constant_p (__n)) | ||
| 2249 | - return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); | ||
| 2250 | - | ||
| 2251 | - if (__n > __bos0 (__s) / sizeof (wchar_t)) | ||
| 2252 | - return __wmemset_chk_warn (__s, __c, __n, | ||
| 2253 | - __bos0 (__s) / sizeof (wchar_t)); | ||
| 2254 | - } | ||
| 2247 | + if (__FORTIFY_CALL_CHK && __bos0 (__s) != (size_t) -1) | 2255 | + if (__FORTIFY_CALL_CHK && __bos0 (__s) != (size_t) -1) |
| 2248 | + return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); | 2256 | + return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); |
| 2249 | return __wmemset_alias (__s, __c, __n); | 2257 | return __wmemset_alias (__s, __c, __n); |
| @@ -2252,7 +2260,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2252 | 2260 | ||
| 2253 | 2261 | ||
| 2254 | extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest, | 2262 | extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest, |
| 2255 | @@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy | 2263 | @@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, |
| 2256 | (wchar_t *__restrict __dest, | 2264 | (wchar_t *__restrict __dest, |
| 2257 | const wchar_t *__restrict __src), wcscpy); | 2265 | const wchar_t *__restrict __src), wcscpy); |
| 2258 | 2266 | ||
| @@ -2264,7 +2272,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2264 | { | 2272 | { |
| 2265 | if (__bos (__dest) != (size_t) -1) | 2273 | if (__bos (__dest) != (size_t) -1) |
| 2266 | return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); | 2274 | return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); |
| 2267 | @@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy | 2275 | @@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, |
| 2268 | (wchar_t *__restrict __dest, | 2276 | (wchar_t *__restrict __dest, |
| 2269 | const wchar_t *__restrict __src), wcpcpy); | 2277 | const wchar_t *__restrict __src), wcpcpy); |
| 2270 | 2278 | ||
| @@ -2276,7 +2284,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2276 | { | 2284 | { |
| 2277 | if (__bos (__dest) != (size_t) -1) | 2285 | if (__bos (__dest) != (size_t) -1) |
| 2278 | return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); | 2286 | return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); |
| 2279 | @@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncp | 2287 | @@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias, |
| 2280 | (wchar_t *__restrict __dest, | 2288 | (wchar_t *__restrict __dest, |
| 2281 | const wchar_t *__restrict __src, | 2289 | const wchar_t *__restrict __src, |
| 2282 | size_t __n), wcsncpy); | 2290 | size_t __n), wcsncpy); |
| @@ -2317,7 +2325,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2317 | 2325 | ||
| 2318 | 2326 | ||
| 2319 | extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest, | 2327 | extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest, |
| 2320 | @@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncp | 2328 | @@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias, |
| 2321 | (wchar_t *__restrict __dest, | 2329 | (wchar_t *__restrict __dest, |
| 2322 | const wchar_t *__restrict __src, | 2330 | const wchar_t *__restrict __src, |
| 2323 | size_t __n), wcpncpy); | 2331 | size_t __n), wcpncpy); |
| @@ -2359,7 +2367,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2359 | 2367 | ||
| 2360 | extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest, | 2368 | extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest, |
| 2361 | const wchar_t *__restrict __src, | 2369 | const wchar_t *__restrict __src, |
| 2362 | @@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat | 2370 | @@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias, |
| 2363 | (wchar_t *__restrict __dest, | 2371 | (wchar_t *__restrict __dest, |
| 2364 | const wchar_t *__restrict __src), wcscat); | 2372 | const wchar_t *__restrict __src), wcscat); |
| 2365 | 2373 | ||
| @@ -2371,7 +2379,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2371 | { | 2379 | { |
| 2372 | if (__bos (__dest) != (size_t) -1) | 2380 | if (__bos (__dest) != (size_t) -1) |
| 2373 | return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); | 2381 | return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); |
| 2374 | @@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsnca | 2382 | @@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, |
| 2375 | const wchar_t *__restrict __src, | 2383 | const wchar_t *__restrict __src, |
| 2376 | size_t __n), wcsncat); | 2384 | size_t __n), wcsncat); |
| 2377 | 2385 | ||
| @@ -2384,7 +2392,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2384 | { | 2392 | { |
| 2385 | if (__bos (__dest) != (size_t) -1) | 2393 | if (__bos (__dest) != (size_t) -1) |
| 2386 | return __wcsncat_chk (__dest, __src, __n, | 2394 | return __wcsncat_chk (__dest, __src, __n, |
| 2387 | @@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprin | 2395 | @@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprintf_alias, |
| 2388 | const wchar_t *__restrict __fmt, ...), | 2396 | const wchar_t *__restrict __fmt, ...), |
| 2389 | swprintf); | 2397 | swprintf); |
| 2390 | 2398 | ||
| @@ -2427,7 +2435,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2427 | } | 2435 | } |
| 2428 | #elif !defined __cplusplus | 2436 | #elif !defined __cplusplus |
| 2429 | /* XXX We might want to have support in gcc for swprintf. */ | 2437 | /* XXX We might want to have support in gcc for swprintf. */ |
| 2430 | @@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s | 2438 | @@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n, |
| 2431 | : swprintf (s, n, __VA_ARGS__)) | 2439 | : swprintf (s, n, __VA_ARGS__)) |
| 2432 | #endif | 2440 | #endif |
| 2433 | 2441 | ||
| @@ -2452,37 +2460,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2452 | { | 2460 | { |
| 2453 | if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) | 2461 | if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) |
| 2454 | return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | 2462 | return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, |
| 2455 | @@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__re | 2463 | @@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag, |
| 2456 | extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, | 2464 | extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, |
| 2457 | __gnuc_va_list __ap); | 2465 | __gnuc_va_list __ap); |
| 2458 | 2466 | ||
| 2459 | -# ifdef __va_arg_pack | 2467 | -# ifdef __va_arg_pack |
| 2460 | -__fortify_function int | 2468 | -__fortify_function int |
| 2461 | -wprintf (const wchar_t *__restrict __fmt, ...) | 2469 | -wprintf (const wchar_t *__restrict __fmt, ...) |
| 2462 | -{ | 2470 | + |
| 2463 | - return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ||
| 2464 | -} | ||
| 2465 | |||
| 2466 | -__fortify_function int | ||
| 2467 | -fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) | ||
| 2468 | -{ | ||
| 2469 | - return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 2470 | - __va_arg_pack ()); | ||
| 2471 | +#ifdef __FORTIFY_ARG_PACK_OK | 2471 | +#ifdef __FORTIFY_ARG_PACK_OK |
| 2472 | +__fortify_potential_overload int | 2472 | +__fortify_potential_overload int |
| 2473 | +wprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt, ...) | 2473 | +wprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt, ...) |
| 2474 | +{ | 2474 | { |
| 2475 | - return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ||
| 2475 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 2476 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 2476 | + int __r = __FORTIFY_CALL_VA_CHK (wprintf, __USE_FORTIFY_LEVEL - 1, __fmt, | 2477 | + int __r = __FORTIFY_CALL_VA_CHK (wprintf, __USE_FORTIFY_LEVEL - 1, __fmt, |
| 2477 | + __FORTIFY_ARG_PACK); | 2478 | + __FORTIFY_ARG_PACK); |
| 2478 | + __FORTIFY_FREE_ARG_PACK(); | 2479 | + __FORTIFY_FREE_ARG_PACK(); |
| 2479 | + return __r; | 2480 | + return __r; |
| 2480 | +} | 2481 | } |
| 2481 | + | 2482 | |
| 2483 | -__fortify_function int | ||
| 2484 | -fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) | ||
| 2482 | +__fortify_potential_overload int | 2485 | +__fortify_potential_overload int |
| 2483 | +fwprintf (__FILE *__restrict const __clang_pass_object_size __stream, | 2486 | +fwprintf (__FILE *__restrict const __clang_pass_object_size __stream, |
| 2484 | + const wchar_t *__restrict __fmt, ...) | 2487 | + const wchar_t *__restrict __fmt, ...) |
| 2485 | +{ | 2488 | { |
| 2489 | - return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, | ||
| 2490 | - __va_arg_pack ()); | ||
| 2486 | + __FORTIFY_INIT_ARG_PACK(__fmt); | 2491 | + __FORTIFY_INIT_ARG_PACK(__fmt); |
| 2487 | + int __r = __FORTIFY_CALL_VA_CHK (fwprintf, __stream, __USE_FORTIFY_LEVEL - 1, | 2492 | + int __r = __FORTIFY_CALL_VA_CHK (fwprintf, __stream, __USE_FORTIFY_LEVEL - 1, |
| 2488 | + __fmt, __FORTIFY_ARG_PACK); | 2493 | + __fmt, __FORTIFY_ARG_PACK); |
| @@ -2491,7 +2496,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2491 | } | 2496 | } |
| 2492 | # elif !defined __cplusplus | 2497 | # elif !defined __cplusplus |
| 2493 | # define wprintf(...) \ | 2498 | # define wprintf(...) \ |
| 2494 | @@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, c | 2499 | @@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) |
| 2495 | __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) | 2500 | __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) |
| 2496 | # endif | 2501 | # endif |
| 2497 | 2502 | ||
| @@ -2511,7 +2516,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2511 | const wchar_t *__restrict __fmt, __gnuc_va_list __ap) | 2516 | const wchar_t *__restrict __fmt, __gnuc_va_list __ap) |
| 2512 | { | 2517 | { |
| 2513 | return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | 2518 | return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); |
| 2514 | @@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *_ | 2519 | @@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n, |
| 2515 | extern wchar_t *__REDIRECT (__fgetws_alias, | 2520 | extern wchar_t *__REDIRECT (__fgetws_alias, |
| 2516 | (wchar_t *__restrict __s, int __n, | 2521 | (wchar_t *__restrict __s, int __n, |
| 2517 | __FILE *__restrict __stream), fgetws) __wur; | 2522 | __FILE *__restrict __stream), fgetws) __wur; |
| @@ -2520,28 +2525,29 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2520 | - __FILE *__restrict __stream), __fgetws_chk) | 2525 | - __FILE *__restrict __stream), __fgetws_chk) |
| 2521 | - __wur __warnattr ("fgetws called with bigger size than length " | 2526 | - __wur __warnattr ("fgetws called with bigger size than length " |
| 2522 | - "of destination buffer"); | 2527 | - "of destination buffer"); |
| 2523 | 2528 | - | |
| 2524 | -__fortify_function __wur wchar_t * | 2529 | -__fortify_function __wur wchar_t * |
| 2525 | -fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) | 2530 | -fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) |
| 2526 | +__fortify_potential_overload __wur wchar_t * | 2531 | -{ |
| 2527 | +fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n, | ||
| 2528 | + __FILE *__restrict __stream) | ||
| 2529 | +__FORTIFY_PRECONDITIONS | ||
| 2530 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s, | ||
| 2531 | + sizeof (wchar_t), | ||
| 2532 | + "fgetws called with length bigger " | ||
| 2533 | + "than size of destination buffer") | ||
| 2534 | { | ||
| 2535 | - if (__bos (__s) != (size_t) -1) | 2532 | - if (__bos (__s) != (size_t) -1) |
| 2536 | - { | 2533 | - { |
| 2537 | - if (!__builtin_constant_p (__n) || __n <= 0) | 2534 | - if (!__builtin_constant_p (__n) || __n <= 0) |
| 2538 | - return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), | 2535 | - return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), |
| 2539 | - __n, __stream); | 2536 | - __n, __stream); |
| 2540 | - | 2537 | |
| 2541 | - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) | 2538 | - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) |
| 2542 | - return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t), | 2539 | - return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t), |
| 2543 | - __n, __stream); | 2540 | - __n, __stream); |
| 2544 | - } | 2541 | - } |
| 2542 | +__fortify_potential_overload __wur wchar_t * | ||
| 2543 | +fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n, | ||
| 2544 | + __FILE *__restrict __stream) | ||
| 2545 | +__FORTIFY_PRECONDITIONS | ||
| 2546 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s, | ||
| 2547 | + sizeof (wchar_t), | ||
| 2548 | + "fgetws called with length bigger " | ||
| 2549 | + "than size of destination buffer") | ||
| 2550 | +{ | ||
| 2545 | + if (__FORTIFY_CALL_CHK && __bos (__s) != (size_t) -1) | 2551 | + if (__FORTIFY_CALL_CHK && __bos (__s) != (size_t) -1) |
| 2546 | + return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); | 2552 | + return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); |
| 2547 | return __fgetws_alias (__s, __n, __stream); | 2553 | return __fgetws_alias (__s, __n, __stream); |
| @@ -2550,7 +2556,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2550 | 2556 | ||
| 2551 | #ifdef __USE_GNU | 2557 | #ifdef __USE_GNU |
| 2552 | extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size, | 2558 | extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size, |
| 2553 | @@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unl | 2559 | @@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unlocked_alias, |
| 2554 | (wchar_t *__restrict __s, int __n, | 2560 | (wchar_t *__restrict __s, int __n, |
| 2555 | __FILE *__restrict __stream), fgetws_unlocked) | 2561 | __FILE *__restrict __stream), fgetws_unlocked) |
| 2556 | __wur; | 2562 | __wur; |
| @@ -2560,9 +2566,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2560 | - __fgetws_unlocked_chk) | 2566 | - __fgetws_unlocked_chk) |
| 2561 | - __wur __warnattr ("fgetws_unlocked called with bigger size than length " | 2567 | - __wur __warnattr ("fgetws_unlocked called with bigger size than length " |
| 2562 | - "of destination buffer"); | 2568 | - "of destination buffer"); |
| 2563 | 2569 | - | |
| 2564 | -__fortify_function __wur wchar_t * | 2570 | -__fortify_function __wur wchar_t * |
| 2565 | -fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) | 2571 | -fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) |
| 2572 | + | ||
| 2566 | +__fortify_potential_overload __wur wchar_t * | 2573 | +__fortify_potential_overload __wur wchar_t * |
| 2567 | +fgetws_unlocked (wchar_t *__restrict const __clang_pass_object_size __s, | 2574 | +fgetws_unlocked (wchar_t *__restrict const __clang_pass_object_size __s, |
| 2568 | + int __n, __FILE *__restrict __stream) | 2575 | + int __n, __FILE *__restrict __stream) |
| @@ -2591,7 +2598,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2591 | #endif | 2598 | #endif |
| 2592 | 2599 | ||
| 2593 | 2600 | ||
| 2594 | @@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_ | 2601 | @@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_alias, |
| 2595 | (char *__restrict __s, wchar_t __wchar, | 2602 | (char *__restrict __s, wchar_t __wchar, |
| 2596 | mbstate_t *__restrict __ps), wcrtomb) __wur; | 2603 | mbstate_t *__restrict __ps), wcrtomb) __wur; |
| 2597 | 2604 | ||
| @@ -2604,7 +2611,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2604 | { | 2611 | { |
| 2605 | /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. | 2612 | /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. |
| 2606 | But this would only disturb the namespace. So we define our own | 2613 | But this would only disturb the namespace. So we define our own |
| 2607 | @@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowc | 2614 | @@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowcs_alias, |
| 2608 | const char **__restrict __src, | 2615 | const char **__restrict __src, |
| 2609 | size_t __len, mbstate_t *__restrict __ps), | 2616 | size_t __len, mbstate_t *__restrict __ps), |
| 2610 | mbsrtowcs); | 2617 | mbsrtowcs); |
| @@ -2615,11 +2622,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2615 | - size_t __dstlen), __mbsrtowcs_chk) | 2622 | - size_t __dstlen), __mbsrtowcs_chk) |
| 2616 | - __warnattr ("mbsrtowcs called with dst buffer smaller than len " | 2623 | - __warnattr ("mbsrtowcs called with dst buffer smaller than len " |
| 2617 | - "* sizeof (wchar_t)"); | 2624 | - "* sizeof (wchar_t)"); |
| 2618 | - | 2625 | |
| 2619 | -__fortify_function size_t | 2626 | -__fortify_function size_t |
| 2620 | -__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, | 2627 | -__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, |
| 2621 | - size_t __len, mbstate_t *__restrict __ps)) | 2628 | - size_t __len, mbstate_t *__restrict __ps)) |
| 2622 | -{ | 2629 | +__fortify_potential_overload size_t |
| 2630 | +__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst, | ||
| 2631 | + const char **__restrict __src, size_t __len, | ||
| 2632 | + mbstate_t *__restrict __ps)) | ||
| 2633 | +__FORTIFY_PRECONDITIONS | ||
| 2634 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst, | ||
| 2635 | + sizeof (wchar_t), | ||
| 2636 | + "mbsrtowcs called with dst buffer " | ||
| 2637 | + "smaller than len * sizeof (wchar_t)") | ||
| 2638 | { | ||
| 2623 | - if (__bos (__dst) != (size_t) -1) | 2639 | - if (__bos (__dst) != (size_t) -1) |
| 2624 | - { | 2640 | - { |
| 2625 | - if (!__builtin_constant_p (__len)) | 2641 | - if (!__builtin_constant_p (__len)) |
| @@ -2630,17 +2646,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2630 | - return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps, | 2646 | - return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps, |
| 2631 | - __bos (__dst) / sizeof (wchar_t)); | 2647 | - __bos (__dst) / sizeof (wchar_t)); |
| 2632 | - } | 2648 | - } |
| 2633 | + | ||
| 2634 | +__fortify_potential_overload size_t | ||
| 2635 | +__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst, | ||
| 2636 | + const char **__restrict __src, size_t __len, | ||
| 2637 | + mbstate_t *__restrict __ps)) | ||
| 2638 | +__FORTIFY_PRECONDITIONS | ||
| 2639 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst, | ||
| 2640 | + sizeof (wchar_t), | ||
| 2641 | + "mbsrtowcs called with dst buffer " | ||
| 2642 | + "smaller than len * sizeof (wchar_t)") | ||
| 2643 | +{ | ||
| 2644 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) | 2649 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) |
| 2645 | + return __mbsrtowcs_chk (__dst, __src, __len, __ps, | 2650 | + return __mbsrtowcs_chk (__dst, __src, __len, __ps, |
| 2646 | + __bos (__dst) / sizeof (wchar_t)); | 2651 | + __bos (__dst) / sizeof (wchar_t)); |
| @@ -2650,7 +2655,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2650 | 2655 | ||
| 2651 | 2656 | ||
| 2652 | extern size_t __wcsrtombs_chk (char *__restrict __dst, | 2657 | extern size_t __wcsrtombs_chk (char *__restrict __dst, |
| 2653 | @@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtomb | 2658 | @@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtombs_alias, |
| 2654 | const wchar_t **__restrict __src, | 2659 | const wchar_t **__restrict __src, |
| 2655 | size_t __len, mbstate_t *__restrict __ps), | 2660 | size_t __len, mbstate_t *__restrict __ps), |
| 2656 | wcsrtombs); | 2661 | wcsrtombs); |
| @@ -2664,15 +2669,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2664 | -__fortify_function size_t | 2669 | -__fortify_function size_t |
| 2665 | -__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, | 2670 | -__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, |
| 2666 | - size_t __len, mbstate_t *__restrict __ps)) | 2671 | - size_t __len, mbstate_t *__restrict __ps)) |
| 2667 | -{ | ||
| 2668 | - if (__bos (__dst) != (size_t) -1) | ||
| 2669 | - { | ||
| 2670 | - if (!__builtin_constant_p (__len)) | ||
| 2671 | - return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); | ||
| 2672 | - | ||
| 2673 | - if (__len > __bos (__dst)) | ||
| 2674 | - return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst)); | ||
| 2675 | - } | ||
| 2676 | +__fortify_potential_overload size_t | 2672 | +__fortify_potential_overload size_t |
| 2677 | +__NTH (wcsrtombs (char *__restrict const __clang_pass_object_size __dst, | 2673 | +__NTH (wcsrtombs (char *__restrict const __clang_pass_object_size __dst, |
| 2678 | + const wchar_t **__restrict __src, size_t __len, | 2674 | + const wchar_t **__restrict __src, size_t __len, |
| @@ -2681,7 +2677,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2681 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsrtombs_warn, __len, __dst, | 2677 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsrtombs_warn, __len, __dst, |
| 2682 | + "wcsrtombs called with dst buffer " | 2678 | + "wcsrtombs called with dst buffer " |
| 2683 | + "smaller than len") | 2679 | + "smaller than len") |
| 2684 | +{ | 2680 | { |
| 2681 | - if (__bos (__dst) != (size_t) -1) | ||
| 2682 | - { | ||
| 2683 | - if (!__builtin_constant_p (__len)) | ||
| 2684 | - return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); | ||
| 2685 | - | ||
| 2686 | - if (__len > __bos (__dst)) | ||
| 2687 | - return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst)); | ||
| 2688 | - } | ||
| 2685 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) | 2689 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) |
| 2686 | + return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); | 2690 | + return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); |
| 2687 | return __wcsrtombs_alias (__dst, __src, __len, __ps); | 2691 | return __wcsrtombs_alias (__dst, __src, __len, __ps); |
| @@ -2690,7 +2694,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2690 | 2694 | ||
| 2691 | 2695 | ||
| 2692 | #ifdef __USE_GNU | 2696 | #ifdef __USE_GNU |
| 2693 | @@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtow | 2697 | @@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias, |
| 2694 | const char **__restrict __src, size_t __nmc, | 2698 | const char **__restrict __src, size_t __nmc, |
| 2695 | size_t __len, mbstate_t *__restrict __ps), | 2699 | size_t __len, mbstate_t *__restrict __ps), |
| 2696 | mbsnrtowcs); | 2700 | mbsnrtowcs); |
| @@ -2701,11 +2705,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2701 | - size_t __dstlen), __mbsnrtowcs_chk) | 2705 | - size_t __dstlen), __mbsnrtowcs_chk) |
| 2702 | - __warnattr ("mbsnrtowcs called with dst buffer smaller than len " | 2706 | - __warnattr ("mbsnrtowcs called with dst buffer smaller than len " |
| 2703 | - "* sizeof (wchar_t)"); | 2707 | - "* sizeof (wchar_t)"); |
| 2704 | - | 2708 | |
| 2705 | -__fortify_function size_t | 2709 | -__fortify_function size_t |
| 2706 | -__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, | 2710 | -__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, |
| 2707 | - size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) | 2711 | - size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) |
| 2708 | -{ | 2712 | +__fortify_potential_overload size_t |
| 2713 | +__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst, | ||
| 2714 | + const char **__restrict __src, size_t __nmc, size_t __len, | ||
| 2715 | + mbstate_t *__restrict __ps)) | ||
| 2716 | +__FORTIFY_PRECONDITIONS | ||
| 2717 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn, | ||
| 2718 | + sizeof (wchar_t) * __len, __dst, | ||
| 2719 | + "mbsnrtowcs called with dst buffer " | ||
| 2720 | + "smaller than len * sizeof (wchar_t)") | ||
| 2721 | { | ||
| 2709 | - if (__bos (__dst) != (size_t) -1) | 2722 | - if (__bos (__dst) != (size_t) -1) |
| 2710 | - { | 2723 | - { |
| 2711 | - if (!__builtin_constant_p (__len)) | 2724 | - if (!__builtin_constant_p (__len)) |
| @@ -2716,17 +2729,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2716 | - return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps, | 2729 | - return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps, |
| 2717 | - __bos (__dst) / sizeof (wchar_t)); | 2730 | - __bos (__dst) / sizeof (wchar_t)); |
| 2718 | - } | 2731 | - } |
| 2719 | + | ||
| 2720 | +__fortify_potential_overload size_t | ||
| 2721 | +__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst, | ||
| 2722 | + const char **__restrict __src, size_t __nmc, size_t __len, | ||
| 2723 | + mbstate_t *__restrict __ps)) | ||
| 2724 | +__FORTIFY_PRECONDITIONS | ||
| 2725 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn, | ||
| 2726 | + sizeof (wchar_t) * __len, __dst, | ||
| 2727 | + "mbsnrtowcs called with dst buffer " | ||
| 2728 | + "smaller than len * sizeof (wchar_t)") | ||
| 2729 | +{ | ||
| 2730 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) | 2732 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) |
| 2731 | + return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, | 2733 | + return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, |
| 2732 | + __bos (__dst) / sizeof (wchar_t)); | 2734 | + __bos (__dst) / sizeof (wchar_t)); |
| @@ -2736,7 +2738,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2736 | 2738 | ||
| 2737 | 2739 | ||
| 2738 | extern size_t __wcsnrtombs_chk (char *__restrict __dst, | 2740 | extern size_t __wcsnrtombs_chk (char *__restrict __dst, |
| 2739 | @@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtom | 2741 | @@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtombs_alias, |
| 2740 | const wchar_t **__restrict __src, | 2742 | const wchar_t **__restrict __src, |
| 2741 | size_t __nwc, size_t __len, | 2743 | size_t __nwc, size_t __len, |
| 2742 | mbstate_t *__restrict __ps), wcsnrtombs); | 2744 | mbstate_t *__restrict __ps), wcsnrtombs); |
| @@ -2747,11 +2749,19 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2747 | - mbstate_t *__restrict __ps, | 2749 | - mbstate_t *__restrict __ps, |
| 2748 | - size_t __dstlen), __wcsnrtombs_chk) | 2750 | - size_t __dstlen), __wcsnrtombs_chk) |
| 2749 | - __warnattr ("wcsnrtombs called with dst buffer smaller than len"); | 2751 | - __warnattr ("wcsnrtombs called with dst buffer smaller than len"); |
| 2750 | - | 2752 | |
| 2751 | -__fortify_function size_t | 2753 | -__fortify_function size_t |
| 2752 | -__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, | 2754 | -__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, |
| 2753 | - size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) | 2755 | - size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) |
| 2754 | -{ | 2756 | +__fortify_potential_overload size_t |
| 2757 | +__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst, | ||
| 2758 | + const wchar_t **__restrict __src, size_t __nwc, size_t __len, | ||
| 2759 | + mbstate_t *__restrict __ps)) | ||
| 2760 | +__FORTIFY_PRECONDITIONS | ||
| 2761 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst, | ||
| 2762 | + "wcsnrtombs called with dst buffer " | ||
| 2763 | + "smaller than len") | ||
| 2764 | { | ||
| 2755 | - if (__bos (__dst) != (size_t) -1) | 2765 | - if (__bos (__dst) != (size_t) -1) |
| 2756 | - { | 2766 | - { |
| 2757 | - if (!__builtin_constant_p (__len)) | 2767 | - if (!__builtin_constant_p (__len)) |
| @@ -2762,16 +2772,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 2762 | - return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps, | 2772 | - return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps, |
| 2763 | - __bos (__dst)); | 2773 | - __bos (__dst)); |
| 2764 | - } | 2774 | - } |
| 2765 | + | ||
| 2766 | +__fortify_potential_overload size_t | ||
| 2767 | +__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst, | ||
| 2768 | + const wchar_t **__restrict __src, size_t __nwc, size_t __len, | ||
| 2769 | + mbstate_t *__restrict __ps)) | ||
| 2770 | +__FORTIFY_PRECONDITIONS | ||
| 2771 | + __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst, | ||
| 2772 | + "wcsnrtombs called with dst buffer " | ||
| 2773 | + "smaller than len") | ||
| 2774 | +{ | ||
| 2775 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) | 2775 | + if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1) |
| 2776 | + return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst)); | 2776 | + return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst)); |
| 2777 | return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps); | 2777 | return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps); |
diff --git a/meta/recipes-core/glibc/glibc_2.31.bb b/meta/recipes-core/glibc/glibc_2.31.bb index b8c570db52..3dec43e537 100644 --- a/meta/recipes-core/glibc/glibc_2.31.bb +++ b/meta/recipes-core/glibc/glibc_2.31.bb | |||
| @@ -32,16 +32,15 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
| 32 | file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ | 32 | file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ |
| 33 | file://0020-eglibc-Cross-building-and-testing-instructions.patch \ | 33 | file://0020-eglibc-Cross-building-and-testing-instructions.patch \ |
| 34 | file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ | 34 | file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ |
| 35 | file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \ | 35 | file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \ |
| 36 | file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \ | 36 | file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \ |
| 37 | file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \ | 37 | file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \ |
| 38 | file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \ | 38 | file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ |
| 39 | file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ | 39 | file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ |
| 40 | file://0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ | 40 | file://0027-intl-Emit-no-lines-in-bison-generated-files.patch \ |
| 41 | file://0028-intl-Emit-no-lines-in-bison-generated-files.patch \ | 41 | file://0028-inject-file-assembly-directives.patch \ |
| 42 | file://0029-inject-file-assembly-directives.patch \ | 42 | file://0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ |
| 43 | file://0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ | 43 | file://0030-Refactor-FORTIFY-in-glibc.patch \ |
| 44 | file://0031-Refactor-FORTIFY-in-glibc.patch \ | ||
| 45 | " | 44 | " |
| 46 | S = "${WORKDIR}/git" | 45 | S = "${WORKDIR}/git" |
| 47 | B = "${WORKDIR}/build-${TARGET_SYS}" | 46 | B = "${WORKDIR}/build-${TARGET_SYS}" |
