From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CA1211382C5 for ; Sat, 3 Apr 2021 03:10:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E19AAE084E; Sat, 3 Apr 2021 03:10:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C8B37E084E for ; Sat, 3 Apr 2021 03:10:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 39969340B77 for ; Sat, 3 Apr 2021 03:10:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B58E3640 for ; Sat, 3 Apr 2021 03:10:37 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1617389698.c4d506d919d9584fb61e3ebfce7ee718eb866b27.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/kernel/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/kernel/files.if policy/modules/kernel/kernel.te X-VCS-Directories: policy/modules/kernel/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: c4d506d919d9584fb61e3ebfce7ee718eb866b27 X-VCS-Branch: master Date: Sat, 3 Apr 2021 03:10:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6cd2981e-203d-4339-973c-071fcc24a463 X-Archives-Hash: 25f2aa944ca8110ace41a4891f9e154d commit: c4d506d919d9584fb61e3ebfce7ee718eb866b27 Author: Chris PeBenito ieee org> AuthorDate: Fri Mar 19 19:50:06 2021 +0000 Commit: Jason Zaman gentoo org> CommitDate: Fri Apr 2 18:54:58 2021 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=c4d506d9 kernel: Add dontaudits when secure_mode_insmod is enabled. Signed-off-by: Chris PeBenito ieee.org> Signed-off-by: Jason Zaman gentoo.org> policy/modules/kernel/files.if | 19 +++++++++++++++++++ policy/modules/kernel/kernel.te | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index 0687a435..349b8696 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -4369,6 +4369,25 @@ interface(`files_load_kernel_modules',` allow $1 modules_object_t:system module_load; ') +######################################## +## +## Load kernel module files. +## +## +## +## Domain allowed access. +## +## +# +interface(`files_dontaudit_load_kernel_modules',` + gen_require(` + type modules_object_t; + ') + + dontaudit $1 modules_object_t:file read_file_perms; + dontaudit $1 modules_object_t:system module_load; +') + ######################################## ## ## List world-readable directories. diff --git a/policy/modules/kernel/kernel.te b/policy/modules/kernel/kernel.te index c44f49ed..2bd3f924 100644 --- a/policy/modules/kernel/kernel.te +++ b/policy/modules/kernel/kernel.te @@ -497,7 +497,20 @@ optional_policy(` # Kernel module loading policy # -if( ! secure_mode_insmod ) { +if(secure_mode_insmod) { + dontaudit can_load_kernmodule self:capability sys_module; + dontaudit can_load_kernmodule self:system module_load; + + files_dontaudit_load_kernel_modules(can_load_kernmodule) + + # load_module() calls stop_machine() which + # calls sched_setscheduler() + # gt: there seems to be no trace of the above, at + # least in kernel versions greater than 2.6.37... + dontaudit can_load_kernmodule self:capability sys_nice; + dontaudit can_load_kernmodule kernel_t:process setsched; + dontaudit can_load_kernmodule kernel_t:key search; +} else { allow can_load_kernmodule self:capability sys_module; allow can_load_kernmodule self:system module_load;