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 29A21138330 for ; Wed, 31 Aug 2016 16:38:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 16CB421C028; Wed, 31 Aug 2016 16:38:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4B35521C012 for ; Wed, 31 Aug 2016 16:38:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6EEC5340831 for ; Wed, 31 Aug 2016 16:38:46 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 09FDB2473 for ; Wed, 31 Aug 2016 16:38:45 +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: <1472657906.aec9eaf2286333e32c87e20244488b162b885df9.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: aec9eaf2286333e32c87e20244488b162b885df9 X-VCS-Branch: master Date: Wed, 31 Aug 2016 16:38:45 +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-Archives-Salt: 79cc97ea-032a-4c80-85c1-5fb54b9d365b X-Archives-Hash: a340f7f87f8dc36a6e8347de4ec30852 commit: aec9eaf2286333e32c87e20244488b162b885df9 Author: Guido Trentalancia trentalancia net> AuthorDate: Fri Aug 19 13:27:32 2016 +0000 Commit: Jason Zaman gentoo org> CommitDate: Wed Aug 31 15:38:26 2016 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=aec9eaf2 Add module_load permission to can_load_kernmodule The "module_load" permission has been recently added to the "system" class (kernel 4.7). The following patch updates the Reference Policy so that the new permission is allowed when a kernel module should be loaded. To preserve the module encapsulation, a new interface is defined in the kernel files module and that interface is then used in the kernel module. A short note is added about unneeded permissions that set the kernel scheduling parameters (might lead to service disruption). Signed-off-by: Guido Trentalancia trentalancia.net> policy/modules/kernel/files.if | 19 +++++++++++++++++++ policy/modules/kernel/kernel.te | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index dc13e31..0d9fddd 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -4160,6 +4160,25 @@ interface(`files_kernel_modules_filetrans',` ######################################## ## +## Load kernel module files. +## +## +## +## Domain allowed access. +## +## +# +interface(`files_load_kernel_modules',` + gen_require(` + type modules_object_t; + ') + + files_read_kernel_modules($1) + allow $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 6467aed..c18e7eb 100644 --- a/policy/modules/kernel/kernel.te +++ b/policy/modules/kernel/kernel.te @@ -429,8 +429,12 @@ optional_policy(` if( ! secure_mode_insmod ) { allow can_load_kernmodule self:capability sys_module; + files_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... allow can_load_kernmodule self:capability sys_nice; kernel_setsched(can_load_kernmodule) }