Skip to content

LSM: Support ptrace sidechannel access checks

Casey Schaufler kernel-hardening linux-security-module lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest5 patches 1 replyIn review
  2. v55 patches 22 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5AppArmor: Prepare for PTRACE_MODE_SCHEDsecurity/apparmor/domain.c security/apparmor/include/ipc.h security/apparmor/ipc.c +1 more+10 -70 replies
2/5Smack: Prepare for PTRACE_MODE_SCHEDsecurity/smack/smack_lsm.c+2 -10 replies
3/5SELinux: Prepare for PTRACE_MODE_SCHEDsecurity/selinux/hooks.c+2 -00 replies
4/5Capability: Complete PTRACE_MODE_SCHEDkernel/ptrace.c security/commoncap.c+2 -30 replies
5/5sidechannel: Linux Security Module for sidechannelinclude/linux/lsm_hooks.h security/Kconfig security/Makefile +4 more+111 -01 reply

Reviews trailers per patch

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

Read the v6 thread

Cover letter [PATCH v6 0/5] LSM: Support ptrace sidechannel access checks

V6: Based on Tim Chen's "[Patch v4 00/18] Provide process property
based options to enable Spectre v2 userspace-userspace protection*" patch set.
v5: Revamped to match Jiri Kosina <[email protected]>
Harden spectrev2 userspace-userspace protection v7
Fixed locking issues in the LSM code.
Dropped the new LSM hook and use a ptrace hook instead.
v4: select namespace checks if user namespaces are enabled
and credential checks are request.
v3: get_task_cred wasn't a good choice due to refcounts.
Use lower level protection instead
v2: SELinux access policy corrected.
Use real_cred instead of cred.

This patchset provide a mechanism by which a security module can advise the system about potential side-channel vulnerabilities. The existing security modules have been updated to avoid locking issues in the face of PTRACE_MODE_SCHED. A new security module is provided to make determinations regarding task attributes including namespaces.

---
 include/linux/lsm_hooks.h          |  5 +++
 kernel/ptrace.c                    |  2 -
 security/Kconfig                   |  1 +
 security/Makefile                  |  2 +
 security/apparmor/domain.c         |  2 +-
 security/apparmor/include/ipc.h    |  2 +-
 security/apparmor/ipc.c            |  8 ++--
 security/apparmor/lsm.c            |  5 ++-
 security/commoncap.c               |  3 +-
 security/security.c                |  1 +
 security/selinux/hooks.c           |  2 +
 security/sidechannel/Kconfig       | 13 ++++++
 security/sidechannel/Makefile      |  1 +
 security/sidechannel/sidechannel.c | 88 ++++++++++++++++++++++++++++++++++++++
 security/smack/smack_lsm.c         |  3 +-
 15 files changed, 127 insertions(+), 11 deletions(-)