From e37a453232066b405d7502814c0c230e298df310 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Oct 18 2023 17:17:46 +0000 Subject: Update to v2.1 and regenerate documentation Resolves: rhbz#2243863 --- diff --git a/.gitignore b/.gitignore index 2ecaf01..ef7c7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/doc-v2.0.6.tar.xz -/v2.0.6.tar.gz +/doc-v2.1.tar.xz +/v2.1.tar.gz diff --git a/libipt-gcc11.patch b/libipt-gcc11.patch deleted file mode 100644 index a00d15a..0000000 --- a/libipt-gcc11.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/libipt/test/src/ptunit-msec_cache.c 2022-01-27 09:32:59.724730213 -0800 -+++ b/libipt/test/src/ptunit-msec_cache.c 2022-01-27 09:31:11.396032237 -0800 -@@ -297,7 +297,7 @@ - static struct ptunit_result fill_nomap(struct test_fixture *tfix) - { - const struct pt_mapped_section *msec; -- struct pt_asid asid; -+ struct pt_asid asid = { 0 }; - struct pt_section *section; - int status; - -@@ -322,7 +322,7 @@ - { - const struct pt_mapped_section *msec; - struct pt_section *section; -- struct pt_asid asid; -+ struct pt_asid asid = { 0 }; - int status; - - memset(&asid, 0, sizeof(asid)); diff --git a/libipt-pttc-lto-fix-lto-strlen-size-warning.patch b/libipt-pttc-lto-fix-lto-strlen-size-warning.patch new file mode 100644 index 0000000..2b9ceb2 --- /dev/null +++ b/libipt-pttc-lto-fix-lto-strlen-size-warning.patch @@ -0,0 +1,41 @@ +From 0144bc2fa99421725585dbc7ecbe2e412f7f8d27 Mon Sep 17 00:00:00 2001 +From: Markus Metzger +Date: Thu, 12 Oct 2023 12:57:41 +0000 +Subject: [PATCH 1/2] pttc, lto: fix lto strnlen size warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building with -flto results in + + .../pttc/src/util.c:48:15: error: ‘strnlen’ specified bound 4096 exceeds source size 1024 [-Werror=stringop-overread] + 48 | len = strnlen(s, n); + | ^ + .../pttc/src/util.c: In function ‘yasm_advance_next_line.part.0’: + .../pttc/src/yasm.c:790:14: note: source object declared here + 790 | char s[1024]; + | ^ + +Increase the size to fix this. + +Signed-off-by: Markus Metzger +--- + pttc/src/yasm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pttc/src/yasm.c b/pttc/src/yasm.c +index 33b8eb9..1004cfa 100644 +--- a/pttc/src/yasm.c ++++ b/pttc/src/yasm.c +@@ -787,7 +787,7 @@ int yasm_lookup_label(const struct yasm *y, uint64_t *addr, + + static int yasm_advance_next_line(struct yasm *y) + { +- char s[1024]; ++ char s[FILENAME_MAX+1]; + char filename[FILENAME_MAX+1]; + int errcode; + int asm_line, asm_inc; +-- +2.41.0 + diff --git a/libipt-ptunit-avoid-lto-maybe-uninitialized-warning.patch b/libipt-ptunit-avoid-lto-maybe-uninitialized-warning.patch new file mode 100644 index 0000000..ab59f89 --- /dev/null +++ b/libipt-ptunit-avoid-lto-maybe-uninitialized-warning.patch @@ -0,0 +1,122 @@ +From b79e10fce4dfceddbc9adb706d7a3300df5fabe6 Mon Sep 17 00:00:00 2001 +From: Markus Metzger +Date: Mon, 16 Oct 2023 07:25:19 +0000 +Subject: [PATCH 2/2] libipt, ptunit: avoid lto maybe-uninitialized warning + +Building with GCC 13 and -flto produces + + In function 'pt_qry_get_offset', + inlined from 'get_offset_null' at .../libipt/test/src/ptunit-block_decoder.c:164:12, + inlined from 'main' at .../libipt/test/src/ptunit-block_decoder.c:336:2: + .../libipt/src/pt_query_decoder.c:380:16: error: 'decoder' may be used uninitialized [-Werror=maybe-uninitialized] + 380 | return pt_evt_get_offset(&decoder->evdec, offset); + | ^ + .../libipt/src/pt_event_decoder.c: In function 'main': + .../libipt/src/pt_event_decoder.c:1541:5: note: by argument 1 of type 'const struct pt_event_decoder *' to 'pt_evt_get_offset' declared here + 1541 | int pt_evt_get_offset(const struct pt_event_decoder *decoder, uint64_t *offset) + | ^ + .../libipt/test/src/ptunit-block_decoder.c:157:33: note: 'decoder' declared here + 157 | struct pt_block_decoder decoder; + | ^ + +Those are false positive since the decoder object isn't actually used. In + + &decoder->evdec + +we compute the address of the event decoder object within the block +decoder object. This adds an offset defined by the type. It does not +actually dereference the pointer to access an uninitialized decoder +object. + +Initialize the test decoder to avoid those warnings. Fixes #101. + +Signed-off-by: Markus Metzger +--- + libipt/test/src/ptunit-block_decoder.c | 4 ++++ + libipt/test/src/ptunit-encoder.c | 2 ++ + libipt/test/src/ptunit-insn_decoder.c | 4 ++++ + libipt/test/src/ptunit-packet_decoder.c | 4 ++++ + 4 files changed, 14 insertions(+) + +diff --git a/libipt/test/src/ptunit-block_decoder.c b/libipt/test/src/ptunit-block_decoder.c +index 44249d3..d1ff288 100644 +--- a/libipt/test/src/ptunit-block_decoder.c ++++ b/libipt/test/src/ptunit-block_decoder.c +@@ -158,6 +158,8 @@ static struct ptunit_result get_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_blk_get_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +@@ -184,6 +186,8 @@ static struct ptunit_result get_sync_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_blk_get_sync_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +diff --git a/libipt/test/src/ptunit-encoder.c b/libipt/test/src/ptunit-encoder.c +index 15d5eb4..edabe9e 100644 +--- a/libipt/test/src/ptunit-encoder.c ++++ b/libipt/test/src/ptunit-encoder.c +@@ -138,6 +138,8 @@ static struct ptunit_result get_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&encoder, 0, sizeof(encoder)); ++ + errcode = pt_enc_get_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +diff --git a/libipt/test/src/ptunit-insn_decoder.c b/libipt/test/src/ptunit-insn_decoder.c +index c8447e7..c5a057c 100644 +--- a/libipt/test/src/ptunit-insn_decoder.c ++++ b/libipt/test/src/ptunit-insn_decoder.c +@@ -158,6 +158,8 @@ static struct ptunit_result get_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_insn_get_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +@@ -184,6 +186,8 @@ static struct ptunit_result get_sync_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_insn_get_sync_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +diff --git a/libipt/test/src/ptunit-packet_decoder.c b/libipt/test/src/ptunit-packet_decoder.c +index 39f1ede..4cb60ad 100644 +--- a/libipt/test/src/ptunit-packet_decoder.c ++++ b/libipt/test/src/ptunit-packet_decoder.c +@@ -158,6 +158,8 @@ static struct ptunit_result get_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_pkt_get_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +@@ -199,6 +201,8 @@ static struct ptunit_result get_sync_offset_null(void) + uint64_t offset; + int errcode; + ++ memset(&decoder, 0, sizeof(decoder)); ++ + errcode = pt_pkt_get_sync_offset(NULL, &offset); + ptu_int_eq(errcode, -pte_invalid); + +-- +2.41.0 + diff --git a/libipt.spec b/libipt.spec index fcdb28f..46cde13 100644 --- a/libipt.spec +++ b/libipt.spec @@ -4,13 +4,14 @@ %global __cmake_in_source_build 1 Name: libipt -Version: 2.0.6 -Release: 2%{?dist} +Version: 2.1 +Release: 1%{?dist} Summary: Intel Processor Trace Decoder Library License: BSD-3-Clause URL: https://github.com/intel/libipt Source0: https://github.com/intel/libipt/archive/v%{version}.tar.gz -Patch0: libipt-gcc11.patch +Patch0: libipt-pttc-lto-fix-lto-strlen-size-warning.patch +Patch1: libipt-ptunit-avoid-lto-maybe-uninitialized-warning.patch Source1: doc-v%{version}.tar.xz # c++ is required only for -DPTUNIT test "ptunit-cpp". BuildRequires: gcc-c++ cmake @@ -40,6 +41,7 @@ develop programs that use the Intel Processor Trace (Intel PT) Decoder Library. %prep %setup -q -n libipt-%{version} %patch -p1 -P 0 +%patch -p1 -P 1 %build %cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -81,6 +83,9 @@ ctest -V %{?_smp_mflags} %{_mandir}/*/*.gz %changelog +* Wed Oct 18 2023 Keith Seitz - 2.1-1 +- Update to v2.1. + * Thu Jul 20 2023 Fedora Release Engineering - 2.0.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index 689f4ce..0cdf9a6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (doc-v2.0.6.tar.xz) = 64e234ec6fa8171b9b19394bf57e9584bad07ca3ac455a6b9cd975f3d3f2fc767f3f944ce439d734b67699c9dcf7c5c0d0042a70742e7732aa3d6a1e35027b4d -SHA512 (v2.0.6.tar.gz) = b61e1dfddc0fda838d0d50ec243ba9c432a4f2283aa62f112df3834ebbd4d2bd6a47345f839f53db49d374eb0640e867361b29600cfa05bdf9ba9a3864304684 +SHA512 (doc-v2.1.tar.xz) = 790a9970f81866fc7c72ca5361a473ad330a5a65e887c3299b0b401929888d0944b622689c40510037576dfd5e22ce782773c94c51326e4fb3f12697e93e0065 +SHA512 (v2.1.tar.gz) = 2290df232efbeaea78df0cd7489e5ae68d79552d0fa428eeae1bf53586e06f954278837435eeeedaf95451f51c8df22daa81783058f32cbcfd995f35d9942c95