ANDROID: selinux: modify RTM_GETNEIGH [1/1]
authorpengzhao.liu <pengzhao.liu@amlogic.com>
Tue, 22 Mar 2022 06:03:33 +0000 (14:03 +0800)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:13:13 +0000 (09:13 +0100)
commit33eee52b2bd927afd34805dd1031a9f2d579d6ea
tree037e621e5fe26c4ddd70428f4ad3fd0ba79c0b37
parentbeb81afadbafd2dcc32c609f5a28a7791b040e2c
ANDROID: selinux: modify RTM_GETNEIGH [1/1]

PD#SWPL-71742
Bug: 171572148

Problem:
Map the permission gating RTM_GETNEIGH/RTM_GETNEIGHTBL messages to a
new permission so that it can be distinguished from the other netlink
route permissions in selinux policy. The new permission is triggered by
a flag set in system images T and up.

Solution:
This change is intended to be backported to all kernels that a T system
image can run on top of.

Verify:
on adt3-t kernel

Test: ateddst NetworkInterfaceTest
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Test: atest bionic-unit-tests-static
Test: On Cuttlefish, run combinations of:
    - Policy bit set or omitted (see https://r.android.com/1701847)
    - This patch applied or omitted
    - App having nlmsg_readneigh permission or not
  Verify that only the combination of this patch + the policy bit being
  set + the app not having the nlmsg_readneigh permission prevents the
  app from sending RTM_GETNEIGH messages.

Change-Id: I4bcfce4decb34ea9388eeedfc4be67403de8a980
Signed-off-by: Bram Bonné <brambonne@google.com>
Signed-off-by: pengzhao.liu <pengzhao.liu@amlogic.com>
Change-Id: Ic9d51cebab8c195537d54a28a23a7e93f09ba0b3
security/selinux/include/classmap.h
security/selinux/include/security.h
security/selinux/nlmsgtab.c
security/selinux/ss/policydb.c
security/selinux/ss/policydb.h
security/selinux/ss/services.c