!52 [sync] PR-50: fix undefined behavior in scmp_bpf_sim.c causing issues when building with clang
From: @openeuler-sync-bot Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
b2a8f8c25b
25
fix_undefined_behavior_in_scmp_bpf_sim.patch
Normal file
25
fix_undefined_behavior_in_scmp_bpf_sim.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 3292da1d4dafab2d18c7b750fa278bcc8a362d04 Mon Sep 17 00:00:00 2001
|
||||
From: q66 <q66@chimera-linux.org>
|
||||
Date: Wed, 20 Dec 2023 04:01:42 +0100
|
||||
Subject: [PATCH] fix UB-ass UB in scmp_bpf_sim
|
||||
|
||||
---
|
||||
tools/scmp_bpf_sim.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c
|
||||
index a381314..eeaa5bc 100644
|
||||
--- a/tools/scmp_bpf_sim.c
|
||||
+++ b/tools/scmp_bpf_sim.c
|
||||
@@ -182,7 +182,8 @@ static void bpf_execute(const struct bpf_program *prg,
|
||||
switch (code) {
|
||||
case BPF_LD+BPF_W+BPF_ABS:
|
||||
if (k < BPF_SYSCALL_MAX) {
|
||||
- uint32_t val = *((uint32_t *)&sys_data_b[k]);
|
||||
+ uint32_t val;
|
||||
+ memcpy(&val, &sys_data_b[k], sizeof(val));
|
||||
state.acc = ttoh32(arch, val);
|
||||
} else
|
||||
exit_error(ERANGE, ip_c);
|
||||
--
|
||||
2.43.0
|
||||
@ -1,6 +1,6 @@
|
||||
Name: libseccomp
|
||||
Version: 2.5.4
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: Interface to the syscall filtering mechanism
|
||||
License: LGPLv2
|
||||
URL: https://github.com/seccomp/libseccomp
|
||||
@ -9,6 +9,8 @@ Source0: https://github.com/seccomp/libseccomp/releases/download/v%{version}/%{n
|
||||
Patch2: backport-arch-disambiguate-in-arch-syscall-validate.patch
|
||||
Patch3: Add-64-bit-LoongArch-support.patch
|
||||
Patch4: fix-build-error-for-libseccomp.patch
|
||||
# https://github.com/chimera-linux/cports/pull/1099
|
||||
Patch5: fix_undefined_behavior_in_scmp_bpf_sim.patch
|
||||
|
||||
BuildRequires: gcc gperf autoconf automake
|
||||
|
||||
@ -79,6 +81,9 @@ make check
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Fri May 10 2024 jchzhou <zhoujiacheng@iscas.ac.cn> - 2.5.4-3
|
||||
- fix undefined behavior in scmp_bpf_sim.c causing issues when building with clang
|
||||
|
||||
* Mon Jul 31 2023 Jingyun Hua<huajingyun@loongson.cn> - 2.5.4-2
|
||||
- add loongarch64 support for libseccomp
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user