
- switch to zstd compression for profile raw data + Cleanups - Simplify obtain the newest label on a cred - remove useless static inline functions - compute permission conversion on policy unpack - refactor code to share common permissins - refactor unpack to group policy backwards compatiblity code - add __init annotation to aa_{setup/teardown}_dfa_engine() + Bug Fixes - fix a memleak in - multi_transaction_new() - free_ruleset() - unpack_profile() - alloc_ns() - fix lockdep warning when removing a namespace - fix regression in stacking due to label flags - fix loading of child before parent - fix kernel-doc comments that differ from fns - fix spelling errors in comments - store return value of unpack_perms_table() to signed variable -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE7cSDD705q2rFEEf7BS82cBjVw9gFAmOZwywACgkQBS82cBjV w9jBjRAAmj4gyK0L3eGY4IV2BpvnkHwHY4lOObJulTwILOOj0Pz8CJqRCa/HDCGj aOlnwqksPsAjadzzfi58D6TnT+3fOuskbcMgTyvX5jraTXPrUl90+hXorbXKuLrw iaX6QxW8soNW/s3oJhrC2HxbIhGA9VpVnmQpVZpJMmz5bU2xmzL62FCN8x88kytr 9CygaudPrvwYJf5pPd62p7ltj2S6lFwZ6dVCyiDQGTc+Gyng4G8p4MCfI1CwMMyo mAUeeRnoeeBwH3tSy/Wsr72jPKjsMASpcMHo3ns/dVSw/ug2FYYToZbfxT/uAa6O WVHfS1Kv/5afG9xxyfocWecd+Yp3lsXq9F+q36uOT9NeJmlej9aJr5sWMcvV3sru QVNN7tFZbHqCnLhpl6RDH/NiguweNYQXrl2lukXZe/FKu/KDasFIOzL+IAt2TqZE 3mWrha7Q7j/gdBw8+fHHGtXCx0NSQlz1oFLo/y/mI7ztwUPJsBYbH5+108iP0ys/ 7Kd+jkYRucJB4upGH4meQbN6f/rrs3+m/b/j0Q8RCFHAs2f+mYZeN/JOHCo0T4YH KO1W60846fPs+7yZTVxWYFpR/kIuXksyxMWpEEZFFtF4MNoaeM1uypBWqm/JmKYr 8oDtEyiOd/qmZnWRcuO3/bmdoJUZY1zTXWA0dlScYc8vR4KC+EE= =6GKy -----END PGP SIGNATURE----- Merge tag 'apparmor-pr-2022-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor Pull apparmor updates from John Johansen: "Features: - switch to zstd compression for profile raw data Cleanups: - simplify obtaining the newest label on a cred - remove useless static inline functions - compute permission conversion on policy unpack - refactor code to share common permissins - refactor unpack to group policy backwards compatiblity code - add __init annotation to aa_{setup/teardown}_dfa_engine() Bug Fixes: - fix a memleak in - multi_transaction_new() - free_ruleset() - unpack_profile() - alloc_ns() - fix lockdep warning when removing a namespace - fix regression in stacking due to label flags - fix loading of child before parent - fix kernel-doc comments that differ from fns - fix spelling errors in comments - store return value of unpack_perms_table() to signed variable" * tag 'apparmor-pr-2022-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor: (64 commits) apparmor: Fix uninitialized symbol 'array_size' in policy_unpack_test.c apparmor: Add __init annotation to aa_{setup/teardown}_dfa_engine() apparmor: Fix memleak in alloc_ns() apparmor: Fix memleak issue in unpack_profile() apparmor: fix a memleak in free_ruleset() apparmor: Fix spelling of function name in comment block apparmor: Use pointer to struct aa_label for lbs_cred AppArmor: Fix kernel-doc LSM: Fix kernel-doc AppArmor: Fix kernel-doc apparmor: Fix loading of child before parent apparmor: refactor code that alloc null profiles apparmor: fix obsoleted comments for aa_getprocattr() and audit_resource() apparmor: remove useless static inline functions apparmor: Fix unpack_profile() warn: passing zero to 'ERR_PTR' apparmor: fix uninitialize table variable in error in unpack_trans_table apparmor: store return value of unpack_perms_table() to signed variable apparmor: Fix kunit test for out of bounds array apparmor: Fix decompression of rawdata for read back to userspace apparmor: Fix undefined references to zstd_ symbols ...
4.2 KiB
SPDX-License-Identifier: GPL-2.0
Makefile for AppArmor Linux Security Module
obj-$(CONFIG_SECURITY_APPARMOR) += apparmor.o
apparmor-y := apparmorfs.o audit.o capability.o task.o ipc.o lib.o match.o
path.o domain.o policy.o policy_unpack.o procattr.o lsm.o
resource.o secid.o file.o policy_ns.o label.o mount.o net.o
policy_compat.o
apparmor-$(CONFIG_SECURITY_APPARMOR_HASH) += crypto.o
obj-$(CONFIG_SECURITY_APPARMOR_KUNIT_TEST) += apparmor_policy_unpack_test.o apparmor_policy_unpack_test-objs += policy_unpack_test.o
clean-files := capability_names.h rlim_names.h net_names.h
Build a lower case string table of address family names
Transform lines from
#define AF_LOCAL 1 /* POSIX name for AF_UNIX */
#define AF_INET 2 /* Internet IP Protocol */
to
[1] = "local",
[2] = "inet",
and build the securityfs entries for the mapping.
Transforms lines from
#define AF_INET 2 /* Internet IP Protocol */
to
#define AA_SFS_AF_MASK "local inet"
quiet_cmd_make-af = GEN $@
cmd_make-af = echo "static const char address_family_names[] = {" > $@ ;
sed $< >>$@ -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e
's/^#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.)/[\2] = "\L\1",/p';
echo "};" >> $@ ;
printf '%s' '#define AA_SFS_AF_MASK "' >> $@ ;
sed -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e
's/^#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.*)/\L\1/p'
$< | tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
Build a lower case string table of sock type names
Transform lines from
SOCK_STREAM = 1,
to
[1] = "stream",
quiet_cmd_make-sock = GEN $@
cmd_make-sock = echo "static const char sock_type_names[] = {" >> $@ ;
sed $^ >>$@ -r -n
-e 's/^\tSOCK_([A-Z0-9_]+)[\t]+=[ \t]+([0-9]+)(.)/[\2] = "\L\1",/p';
echo "};" >> $@
Build a lower case string table of capability names
Transforms lines from
#define CAP_DAC_OVERRIDE 1
to
[1] = "dac_override",
quiet_cmd_make-caps = GEN $@
cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;
sed $< >>$@ -r -n -e '/CAP_FS_MASK/d'
-e 's/^#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/[\2] = "\L\1",/p';
echo "};" >> $@ ;
printf '%s' '#define AA_SFS_CAPS_MASK "' >> $@ ;
sed $< -r -n -e '/CAP_FS_MASK/d'
-e 's/^#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/\L\1/p' |
tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
Build a lower case string table of rlimit names.
Transforms lines from
#define RLIMIT_STACK 3 /* max stack size */
to
[RLIMIT_STACK] = "stack",
and build a second integer table (with the second sed cmd), that maps
RLIMIT defines to the order defined in asm-generic/resource.h This is
required by policy load to map policy ordering of RLIMITs to internal
ordering for architectures that redefine an RLIMIT.
Transforms lines from
#define RLIMIT_STACK 3 /* max stack size */
to
RLIMIT_STACK,
and build the securityfs entries for the mapping.
Transforms lines from
#define RLIMIT_FSIZE 1 /* Maximum filesize */
#define RLIMIT_STACK 3 /* max stack size */
to
#define AA_SFS_RLIMIT_MASK "fsize stack"
quiet_cmd_make-rlim = GEN $@
cmd_make-rlim = echo "static const char const rlim_names[RLIM_NLIMITS] = {"
> $@ ;
sed $< >> $@ -r -n
-e 's/^# ?define[ \t]+(RLIMIT_([A-Z0-9_]+))./[\1] = "\L\2",/p';
echo "};" >> $@ ;
echo "static const int rlim_map[RLIM_NLIMITS] = {" >> $@ ;
sed -r -n "s/^# ?define[ \t]+(RLIMIT_[A-Z0-9_]+)./\1,/p" $< >> $@ ;
echo "};" >> $@ ;
printf '%s' '#define AA_SFS_RLIMIT_MASK "' >> $@ ;
sed -r -n 's/^# ?define[ \t]+RLIMIT_([A-Z0-9_]+)./\L\1/p' $< |
tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
$(obj)/capability.o : $(obj)/capability_names.h
$(obj)/net.o : $(obj)/net_names.h
$(obj)/resource.o : $(obj)/rlim_names.h
$(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h
$(src)/Makefile
$(call cmd,make-caps)
$(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h
$(src)/Makefile
$(call cmd,make-rlim)
$(obj)/net_names.h : $(srctree)/include/linux/socket.h
$(srctree)/include/linux/net.h
$(src)/Makefile
$(call cmd,make-af)
$(call cmd,make-sock)