Skip to content

selinux: export current_sid API for use in other kernel modules

[email protected] linux-arm-kernel linux-mediatek lkml selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1selinux: export current_sid API for use in other kernel modulessecurity/selinux/hooks.c security/selinux/include/objsec.h+13 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] selinux: export current_sid API for use in other kernel modules

From: Xion Wang <[email protected]>

We have a kernel driver designed to monitor the status of the Android userspace watchdog. The implementation works as follows: we modify the Android userspace watchdog code to periodically send a "kick" signal to the kernel driver via ioctl, so that the kernel driver can determine whether the userspace is still responsive. If the kernel driver does not receive a kick signal from the userspace watchdog within a certain period, it infers that the userspace is stuck. In this case, the kernel driver will dump key process information at the kernel level and trigger a full system reboot.

To ensure that only the legitimate Android userspace watchdog process can access the ioctl interface and perform the kick operation, and to prevent malicious or unauthorized processes from spoofing the kick action (which could compromise system reliability), we want to identify the calling task by its security identifier (sid). By checking the sid, we can effectively prevent unauthorized processes from sending kick signals.

Currently, the current_sid() function in the kernel is defined as static inline and cannot be directly called from modules or drivers. We propose to export this function, so that the kernel driver can call current_sid() to obtain the sid of the current process and decide whether to allow the kick operation.

This change will help enhance system security and robustness by preventing the watchdog mechanism from being bypassed or abused.

I would like to ask the maintainers if there are any additional security concerns regarding exporting current_sid() as a public API, or if there are any alternative or more recommended approaches to achieve this goal. Any feedback or suggestions would be greatly appreciated.

Xion Wang (1):
selinux: export current_sid API for use in other kernel modules

 security/selinux/hooks.c          | 11 +++++++++++
 security/selinux/include/objsec.h | 12 ++----------
 2 files changed, 13 insertions(+), 10 deletions(-)
Signature · 1 line
2.45.2