Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3891573imm; Tue, 29 May 2018 16:15:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL9R4+ypWWdOIMn8pnxqEsRa1PAQeJ5HTEjnUw64K4p4v/7B0TFzAKXptiduhyezcbeD4xx X-Received: by 2002:a62:1656:: with SMTP id 83-v6mr360531pfw.61.1527635726905; Tue, 29 May 2018 16:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527635726; cv=none; d=google.com; s=arc-20160816; b=0+V03puKgXsi4TWm9TyyrviQI5WKwr2QuZrrDcxCatvpJ6XU3XinyR4S9zkYl+sRe2 YaUg2fanSZZYu2lSoS67+sRmQr3Z0sRtiqz4il4vEV8XGl4LXbKWUD2tiLs0rQBsv75A FD4SXb4GzCiSdl54No380iTr1P7Q5N0oC3iKLj9nA4f6lT10ui1bDdRodnD3RMYStATC Rd+Udw35GJkoaZkZj4mbj2xJkYozSSWcLrpbyB9C6pSrlnw0gMrkY3jYptpPar7lMnag UoWLBq6WWiKRB7YEKkr+vUjVW44hvuG1G1wz5CjchUzYC4qhw3+e2n4FuMxPhU0FxPFy 6Stw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject :arc-authentication-results; bh=+xJhbyHzMCzUsj1iityzQ1Ji5nQJSY1IVLlCeiJJz9w=; b=mzqF1F7z9dA2gLJNsf9dCUpBd0GKITlksEjOScjxith/5TziACRTa8JY8RNbzDelD4 MAUqBAs7yiGZcgX4Gr5dPHpFvkjOJ+KfzFI1MHfqTx2WV+cA8FxDhZVaAcxe+1PaPtXH w4tSlPTMANP1ZdoAQivIDUDRbVCSOvHeeAjMOQ5vKJdd4AspRLWmqcKDEOIGmqsWTWwd omu7wfZvqJ1jS5WFoH+mCwplaRZ0dq18GiiCabemW/pT1DtEcVZzG2jX9LRGc5lxbDj+ 9Ad93+e7LlbjB3jtrLWhgVJup5n8eIpgMlJZCJqdIuNwy8BDeFCD/lNSLh0+Ya1k2/4I wFkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i61-v6si23231637plb.138.2018.05.29.16.15.12; Tue, 29 May 2018 16:15:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967906AbeE2XOU (ORCPT + 99 others); Tue, 29 May 2018 19:14:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42912 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964853AbeE2XOQ (ORCPT ); Tue, 29 May 2018 19:14:16 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4TNDkk7117411 for ; Tue, 29 May 2018 19:14:16 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j9ewm2rcc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 29 May 2018 19:14:15 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 May 2018 00:14:14 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 30 May 2018 00:14:08 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4TNE7BA23986384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 29 May 2018 23:14:07 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D59D0AE045; Wed, 30 May 2018 00:03:13 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70141AE051; Wed, 30 May 2018 00:03:12 +0100 (BST) Received: from dhcp-9-2-54-219.watson.ibm.com (unknown [9.2.54.219]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 30 May 2018 00:03:12 +0100 (BST) Subject: Re: [PATCH v4 8/8] module: replace the existing LSM hook in init_module From: Mimi Zohar To: Paul Moore Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , Eric Biederman , kexec@lists.infradead.org, Andres Rodriguez , Greg Kroah-Hartman , Ard Biesheuvel , Jeff Vander Stoep , Casey Schaufler Date: Tue, 29 May 2018 19:14:05 -0400 In-Reply-To: References: <1527616920-5415-1-git-send-email-zohar@linux.vnet.ibm.com> <1527616920-5415-9-git-send-email-zohar@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18052923-0040-0000-0000-0000045EB0EC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052923-0041-0000-0000-000021032401 Message-Id: <1527635645.3534.39.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-29_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805290247 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-05-29 at 18:39 -0400, Paul Moore wrote: [...] > > @@ -4043,6 +4037,25 @@ static int selinux_kernel_module_from_file(struct file *file) > > SYSTEM__MODULE_LOAD, &ad); > > } > > > > +static int selinux_kernel_load_data(enum kernel_load_data_id id) > > +{ > > + u32 sid; > > + int rc = 0; > > + > > + switch (id) { > > + case LOADING_MODULE: > > + sid = current_sid(); > > + > > + /* init_module */ > > + return avc_has_perm(&selinux_state, sid, sid, SECCLASS_SYSTEM, > > + SYSTEM__MODULE_LOAD, NULL); > > + default: > > + break; > > + } > > + > > + return rc; > > +} > > I'm not a fan of the duplication here. If we must have a new LSM hook > for this, can we at least have it call > selinux_kernel_module_from_file() so we have all the kernel module > loading logic/controls in one function? Yes, I understand there are > differences between init_module() and finit_module() but I like > handling them both in one function as we do today. There's some disagreement as to whether we really need two LSM hooks.  This sounds like you would prefer a single LSM hook, not the two that this patch set introduces. We need to come to some consensus.  (Comments appreciated in 0/8.) Mimi > > > static int selinux_kernel_read_file(struct file *file, > > enum kernel_read_file_id id) > > { > > @@ -6950,6 +6963,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = { > > LSM_HOOK_INIT(kernel_act_as, selinux_kernel_act_as), > > LSM_HOOK_INIT(kernel_create_files_as, selinux_kernel_create_files_as), > > LSM_HOOK_INIT(kernel_module_request, selinux_kernel_module_request), > > + LSM_HOOK_INIT(kernel_load_data, selinux_kernel_load_data), > > LSM_HOOK_INIT(kernel_read_file, selinux_kernel_read_file), > > LSM_HOOK_INIT(task_setpgid, selinux_task_setpgid), > > LSM_HOOK_INIT(task_getpgid, selinux_task_getpgid), > > -- > > 2.7.5 > > >