apparmor/libraries/libapparmor/src
Georgia Garcia 81948655c2 libapparmor: make af_protos.h consistent in different archs
af_protos.h is a generated table of the protocols created by looking
for definitions of IPPROTO_* in netinet/in.h. Depending on the
architecture, the order of the table may change when using -dM in the
compiler during the extraction of the defines.

This causes an issue because there is more than one IPPROTO defined
by the value 0: IPPROTO_IP and IPPROTO_HOPOPTS which is a header
extension used by IPv6. So if IPPROTO_HOPOPTS was first in the table,
then protocol=0 in the audit logs would be translated to hopopts.

This caused a failure in arm 32bit:

Output doesn't match expected data:
--- ./test_multi/testcase_unix_01.out	2024-08-15 01:47:53.000000000 +0000
+++ ./test_multi/out/testcase_unix_01.out	2024-08-15 23:42:10.187416392 +0000
@@ -12,7 +12,7 @@
 Peer Addr: @test_abstract_socket
 Network family: unix
 Socket type: stream
-Protocol: ip
+Protocol: hopopts
 Class: net
 Epoch: 1711454639
 Audit subid: 322

By the time protocol is resolved in grammar.y, we don't have have
access to the net family to check if it's inet6. Instead of making
protocol dependent on the net family, make the order of the
af_protos.h table consistent between architectures using -dD.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
(cherry picked from commit 95c419dc45)
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-08-26 09:42:11 -03:00
..
features.c libapparmor: fix handling of failed symlink traversal 2022-02-27 00:55:41 -08:00
grammar.y libapparmor: add support for class in logparsing 2023-02-24 04:09:12 -08:00
kernel.c libapparmor: fix building with link time optimization (lto) 2022-02-04 15:01:36 -08:00
kernel_interface.c treewide: spelling/typo fixes in comments and docs 2020-12-01 12:47:11 -08:00
libaalogparse.c libapparmor: add support for class in logparsing 2023-02-24 04:09:12 -08:00
libapparmor.map libapparmor: fix building with link time optimization (lto) 2022-02-04 15:01:36 -08:00
libapparmor.pc.in Given that we want to do more apparmor things in user space (dbus 2012-11-14 11:00:06 -08:00
Makefile.am libapparmor: make af_protos.h consistent in different archs 2024-08-26 09:42:11 -03:00
parser.h libraries/libapparmor/: more license cleanups, adjust my email address 2011-02-23 14:02:45 -08:00
PMurHash.c libapparmor: convert multicache from using djb2 hashing to murmur3 hash 2018-04-14 15:51:23 -07:00
PMurHash.h libapparmor: convert multicache from using djb2 hashing to murmur3 hash 2018-04-14 15:51:23 -07:00
policy_cache.c libapparmor: fix handling of failed symlink traversal 2022-02-27 00:55:41 -08:00
private.c libapparmor: fix handling of failed symlink traversal 2022-02-27 00:55:41 -08:00
private.h libapparmor: handle feature hash collision by falling back to next dir 2018-04-14 15:51:23 -07:00
scanner.l libapparmor: add support for class in logparsing 2023-02-24 04:09:12 -08:00
tst_aalogmisc.c libapparmor: fix memory leaks in aalogmisc unit tests. 2015-08-27 13:47:52 -07:00
tst_features.c Explicitly initialize component in test_walk_one 2024-08-06 17:28:03 -03:00
tst_kernel.c libapparmor: Strip a trailing newline character in aa_splitcon(3) 2015-05-19 21:31:53 -05:00