strace/0182-tests-bpf-fix-sloppy-l...

71 lines
3.5 KiB
Diff
Raw Normal View History

Fix post-rebase issues - Add 0175-src-xlat-remove-remnants-of-unnecessary-idx-usage-in.patch (v5.18-5-g2bf0696 "src/xlat: remove remnants of unnecessary idx usage in xlookup") - Add 0176-strauss-tips-whitespace-and-phrasing-cleanups.patch (v5.18-7-ge604d7b "strauss: tips whitespace and phrasing cleanups") - Add 0177-strauss-fix-off-by-one-error-in-strauss-array-access.patch (v5.18-8-g968789d "strauss: fix off-by-one error in strauss array access") - Add 0178-util-add-offs-sanity-check-to-print_clock_t.patch (v5.18-9-g6d3e97e "util: add offs sanity check to print_clock_t") - Add 0179-secontext-print-context-of-Unix-socket-s-sun_path-fi.patch (v5.18-13-g960e78f "secontext: print context of Unix socket's sun_path field") - Add 0180-pathtrace-util-do-not-print-deleted-as-part-of-the-p.patch (v5.18-18-g676979f "pathtrace, util: do not print " (deleted)" as part of the path") - Add 0181-secontext-fix-expected-SELinux-context-check-for-unl.patch )v5.18-19-g3f0e534 "secontext: fix expected SELinux context check for unlinked FDs") - Add 0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch (v5.18-21-g5338636 "tests/bpf: fix sloppy low FD number usage") * 0175-src-xlat-remove-remnants-of-unnecessary-idx-usage-in.patch: New patch. * 0176-strauss-tips-whitespace-and-phrasing-cleanups.patch: Likewise. * 0177-strauss-fix-off-by-one-error-in-strauss-array-access.patch: Likewise. * 0178-util-add-offs-sanity-check-to-print_clock_t.patch: Likewise. * 0179-secontext-print-context-of-Unix-socket-s-sun_path-fi.patch: Likewise. * 0180-pathtrace-util-do-not-print-deleted-as-part-of-the-p.patch: Likewise. * 0181-secontext-fix-expected-SELinux-context-check-for-unl.patch: Likewise. * 0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch: Likewise. * strace.spec (Release): Bump to 2. (Patch175, Patch176, Patch177, Patch178, Patch179, Patch180, Patch181, Patch182): Add. (%prep): Apply them. (%changelog): New record about 5.18-2. Resolves: #2087693 Resolves: #2103068 Resolves: #2103032 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2022-07-13 11:07:07 +00:00
From 5338636cd9ae7f53ed73f1a7909db03189ea2ff3 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Mon, 4 Jul 2022 12:29:22 +0200
Subject: [PATCH] tests/bpf: fix sloppy low FD number usage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
FD 42 can already be opened, so close it. Otherwise, it may lead
to the following test failure:
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
bpf(BPF_LINK_CREATE, 0x3ff95574fe5, 28) = 841540765612359407 (INJECTED)
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
[...]
FAIL bpf-success-long-y.test (exit status: 1)
* tests/bpf.c (init_BPF_LINK_CREATE_attr7): Close iter_info_data[1] fd.
Fixes: v5.18~18 "bpf: improve bpf(BPF_LINK_CREATE) decoding"
Reported-by: Lenka Špačková <lkuprova@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103137
---
tests/bpf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/bpf.c b/tests/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
diff --git a/tests-m32/bpf.c b/tests-m32/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests-m32/bpf.c
+++ b/tests-m32/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
diff --git a/tests-mx32/bpf.c b/tests-mx32/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests-mx32/bpf.c
+++ b/tests-mx32/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
--
2.1.4