diff options
| author | Ross Burton <ross@burtonini.com> | 2022-01-14 18:04:28 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-15 16:23:24 +0000 |
| commit | c1af5e38198257a68560800799b346f8c24f7a5b (patch) | |
| tree | 601de8f253736282918f2df0f1ab2eed906af100 /meta/recipes-kernel/systemtap | |
| parent | b57407fbdffa56741df45fbcbe9461293523d4d5 (diff) | |
| download | poky-c1af5e38198257a68560800799b346f8c24f7a5b.tar.gz | |
systemtap: fix vsprintf errors
In some configurations (such as 32-bit arm), using printf() causes
gcc errors. Backport a patch from upstream to fix this.
(From OE-Core rev: 6340a6477ddf0fee6c18cf99262704a715491f60)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/systemtap')
| -rw-r--r-- | meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch | 45 | ||||
| -rw-r--r-- | meta/recipes-kernel/systemtap/systemtap_git.inc | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch b/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch new file mode 100644 index 0000000000..0801cb57ec --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | Upstream-Status: Backport | ||
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
| 3 | |||
| 4 | From b0422e9e5a539164af75cddcaeb01bceca56bf12 Mon Sep 17 00:00:00 2001 | ||
| 5 | From: "Frank Ch. Eigler" <fche@redhat.com> | ||
| 6 | Date: Thu, 13 Jan 2022 18:33:15 -0500 | ||
| 7 | Subject: [PATCH] PR28778: gcc warning tweak for sprintf precision parameter | ||
| 8 | |||
| 9 | A precision=-1 sentinel value got interpreted as UINT_MAX in a | ||
| 10 | context, leading to diagnostics like: | ||
| 11 | |||
| 12 | /usr/share/systemtap/runtime/vsprintf.c:341:23: error: 'strnlen' specified bound 4294967295 may exceed maximum object size 2147483647 [-Werror=stringop-overread] | ||
| 13 | |||
| 14 | Adding a clamp_t() around the parameter field to keep it limited to | ||
| 15 | STP_BUFFER_SIZE (8K by default), which is apprx. the limit for a | ||
| 16 | single printf. | ||
| 17 | --- | ||
| 18 | runtime/vsprintf.c | 4 ++-- | ||
| 19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c | ||
| 22 | index cd31a938b..606f685e8 100644 | ||
| 23 | --- a/runtime/vsprintf.c | ||
| 24 | +++ b/runtime/vsprintf.c | ||
| 25 | @@ -338,7 +338,7 @@ _stp_vsprint_memory(char * str, char * end, const char * ptr, | ||
| 26 | if (format == 's') { | ||
| 27 | if ((unsigned long)ptr < PAGE_SIZE) | ||
| 28 | ptr = "<NULL>"; | ||
| 29 | - len = strnlen(ptr, precision); | ||
| 30 | + len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); | ||
| 31 | } | ||
| 32 | else if (precision > 0) | ||
| 33 | len = precision; | ||
| 34 | @@ -410,7 +410,7 @@ _stp_vsprint_memory_size(const char * ptr, int width, int precision, | ||
| 35 | if (format == 's') { | ||
| 36 | if ((unsigned long)ptr < PAGE_SIZE) | ||
| 37 | ptr = "<NULL>"; | ||
| 38 | - len = strnlen(ptr, precision); | ||
| 39 | + len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); | ||
| 40 | } | ||
| 41 | else if (precision > 0) | ||
| 42 | len = precision; | ||
| 43 | -- | ||
| 44 | 2.25.1 | ||
| 45 | |||
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc index 22b07f1516..36c934c2fa 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.inc +++ b/meta/recipes-kernel/systemtap/systemtap_git.inc | |||
| @@ -7,6 +7,7 @@ SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master \ | |||
| 7 | file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ | 7 | file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ |
| 8 | file://0001-Install-python-modules-to-correct-library-dir.patch \ | 8 | file://0001-Install-python-modules-to-correct-library-dir.patch \ |
| 9 | file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ | 9 | file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ |
| 10 | file://0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch \ | ||
| 10 | " | 11 | " |
| 11 | 12 | ||
| 12 | COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux' | 13 | COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux' |
