fix undefined behavior in scmp_bpf_sim.c causing issues when building with clang
Signed-off-by: jchzhou <zhoujiacheng@iscas.ac.cn> (cherry picked from commit e258642b09c628e0fe81795bf579905504edf8cf)
This commit is contained in:
parent
14ac05d08e
commit
686e93d6dd
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
|
Name: libseccomp
|
||||||
Version: 2.5.4
|
Version: 2.5.4
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: Interface to the syscall filtering mechanism
|
Summary: Interface to the syscall filtering mechanism
|
||||||
License: LGPLv2
|
License: LGPLv2
|
||||||
URL: https://github.com/seccomp/libseccomp
|
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
|
Patch2: backport-arch-disambiguate-in-arch-syscall-validate.patch
|
||||||
Patch3: Add-64-bit-LoongArch-support.patch
|
Patch3: Add-64-bit-LoongArch-support.patch
|
||||||
Patch4: fix-build-error-for-libseccomp.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
|
BuildRequires: gcc gperf autoconf automake
|
||||||
|
|
||||||
@ -79,6 +81,9 @@ make check
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%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
|
* Mon Jul 31 2023 Jingyun Hua<huajingyun@loongson.cn> - 2.5.4-2
|
||||||
- add loongarch64 support for libseccomp
|
- add loongarch64 support for libseccomp
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user