diff --git a/pkg/prebuild/build.go b/pkg/prebuild/build.go index 0dc1f079..add73dfc 100644 --- a/pkg/prebuild/build.go +++ b/pkg/prebuild/build.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/roddhjav/apparmor.d/pkg/aa" + "github.com/roddhjav/apparmor.d/pkg/util" "golang.org/x/exp/slices" ) @@ -21,6 +22,12 @@ var ( regAttachments = regexp.MustCompile(`(profile .* @{exec_path})`) regFlags = regexp.MustCompile(`flags=\(([^)]+)\)`) regProfileHeader = regexp.MustCompile(` {`) + regAbi4To3 = util.ToRegexRepl([]string{ + `abi/4.0`, `abi/3.0`, + `(?m)^.*mqueue.*$`, ``, + `(?m)^.*userns.*$`, ``, + `(?m)^.*io_uring.*$`, ``, + }) ) type BuildFunc func(string) string @@ -79,3 +86,10 @@ func BuildUserspace(profile string) string { } return profile } + +func BuildABI3(profile string) string { + for _, abi4t3 := range regAbi4To3 { + profile = abi4t3.Regex.ReplaceAllLiteralString(profile, abi4t3.Repl) + } + return profile +}