aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/libseccomp.go
blob: d4a9025d282eddf7a71e8a867fee03a4b88a61a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newLibseccomp() (pkg.Artifact, string) {
	const (
		version  = "2.6.0"
		checksum = "mMu-iR71guPjFbb31u-YexBaanKE_nYPjPux-vuBiPfS_0kbwJdfCGlkofaUm-EY"
	)
	return t.NewPackage("libseccomp", version, newFromGitHubRelease(
		"seccomp/libseccomp",
		"v"+version,
		"libseccomp-"+version+".tar.gz",
		checksum,
		pkg.TarGzip,
	), &PackageAttr{
		ScriptEarly: `
ln -s ../system/bin/bash /bin/
`,

		Patches: []KV{
			{"fix-export-oob-read", `diff --git a/src/api.c b/src/api.c
index adccef3..65a277a 100644
--- a/src/api.c
+++ b/src/api.c
@@ -786,7 +786,7 @@ API int seccomp_export_bpf_mem(const scmp_filter_ctx ctx, void *buf,
                if (BPF_PGM_SIZE(program) > *len)
                        rc = _rc_filter(-ERANGE);
                else
-                       memcpy(buf, program->blks, *len);
+                       memcpy(buf, program->blks, BPF_PGM_SIZE(program));
        }
        *len = BPF_PGM_SIZE(program);
 
`},
		},
	}, (*MakeHelper)(nil),
		Bash,
		Diffutils,
		Gperf,

		KernelHeaders,
	), version
}
func init() {
	artifactsM[Libseccomp] = Metadata{
		f: Toolchain.newLibseccomp,

		Name:        "libseccomp",
		Description: "an interface to the Linux Kernel's syscall filtering mechanism",
		Website:     "https://github.com/seccomp/libseccomp/",

		ID: 13823,
	}
}