Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp153224imm; Thu, 10 May 2018 17:31:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoFGf0G2DH8hZ/MXL8xPb1Ma229UCrJM0tOnLauvTYufrRZZLziLy6tLXtRe2B/s3Sw4nc1 X-Received: by 2002:a62:14c3:: with SMTP id 186-v6mr3304206pfu.92.1525998691101; Thu, 10 May 2018 17:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525998691; cv=none; d=google.com; s=arc-20160816; b=vVr6jgrvUR+01hp+M20TKafYCSHhh77BjAimoP0tnBx/4tJDS0mw9PPdb8FYJkUEAW QiDfaB4DtW15JAFjYgxdqwM0ID41QscyilQxE2gpRP0h2ykU0hCPK1qamjzWxyc639XS 5T/3dfwXIvoOnoLNpQwcIb+IYHMpgcqnNklZiECbIhxi5aLaE5mpRHHRWgT09DaZpYkK jnioanDL5NFkGAJYiEBbPKOPxLNt5i2vUKWdGfgCLgfwFce1qugDT60y+f5LgW8ftaJ8 mt4p4eSpWeJRStG+izwhg6FXngK3bgWHiwcWd1fG6v+vVfgxuQH7+g5qEQyBRS0Y9NbF RQSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:cc:to:dkim-signature:arc-authentication-results; bh=nOmXEvXQEGMFp9/FDNBDYrnvBkrKkcMDjMx97eRI9/c=; b=MTiV3ZIBa7abJfKjGAOucXDomfsgI9wd7S3f6V3CDxyq38q/nUWwNkGq27HxSjhD/u wxdcw4YbAB4/+rxvipCVo5OgzfbIADduCrk37cE5BtUynvupUqSb5j+S8lTvxO9BFzl1 47zJOnVXJUDzqG2C/6uM9fV+Ry0ayr15l0yWZyiHlck/rc1jIey9S2O4/CSs2Do9AwQr LzUDXwLi3jJJwc+t/xzJrDRUZiQ29X5z7V9E6wa/hjATLZJWbQ9OXbaPFd380Jd9fFDE dSJqA0/2bSNxzi9OV+tpXIzOIJizyMiq0RUl94KmmTZgHgHsSBkuAWfhL8GwFeFETQfZ Zriw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=eQoz3Kay; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e98-v6si1960466plb.273.2018.05.10.17.31.03; Thu, 10 May 2018 17:31:31 -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; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=eQoz3Kay; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751168AbeEKAaw (ORCPT + 99 others); Thu, 10 May 2018 20:30:52 -0400 Received: from sonic313-17.consmr.mail.ne1.yahoo.com ([66.163.185.40]:34272 "EHLO sonic313-17.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746AbeEKAat (ORCPT ); Thu, 10 May 2018 20:30:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1525998648; bh=nOmXEvXQEGMFp9/FDNBDYrnvBkrKkcMDjMx97eRI9/c=; h=To:Cc:From:Subject:Date:From:Subject; b=eQoz3KayhCLOl/jMg1AufC+/Ma3o5tNkd/TeJ/oQ2u3+tIobxaYqab/pIDSnSw4ow+uYhJ1waUzYJtHyWD7c2lpBGMoXtEEUbmCEZrDJcbWo2oMdu7rOanu7Ies1z7chYSgK8pzcmTcP8RVb331Qfrj9QdxwGue5f4UpM4Pvj6UJkJQQJggk9+MTLDiHzBdIS7mo4NzbpXmU3+IDg9YaQTv52AwXKeLmlvRX8mFdR21bDkaYEcYihzZb9cLJqfKlCL5NlBSu48BafChgC4klxXKY7AgGP5gBTfjad93lSMw4GQVAdI0w9KQySuGVWWK28lZtpPfYilCcIPCZAeJ92A== X-YMail-OSG: n3eouo0VM1ngCJM_YoAJ7NBWR8uRlHcWxngCNGGdVmOIQ_tBAveD1PxNvJ1T_6g PFDti4Sh3etdsG.kA_qR3s6hxycjmfyH07AIHRiqnFDVCdqjtgPeGVCGFvYg50OkPmY7wvzEhK9M wsyzZYSJTqI910ErdpkKCAf4NfSBaDqmFePbcVkYVPKL1ICRgEMVDAG2j7YEyGf0aP3KWM0YKcmF x3A3FozoRYl5W_mL_0mxStbe9n.of_u2.R2ZB9P73z7G6Ij5ygh.Z7tYI6JNECjNUeB4t6dE8xkv 6poWZTe6pSprc6ujXOp3Dd3Rd4sRn7828G1xJRICX.LIX9FwUEVxVMuFsVzOzwzsebh7dCxcFHBd skizuu10OW6h7xLuVE4C_s9Y0krK5kAvX7upHsrs3.zZoFpBxgyyujJyTJm9cghvfg03uG8otd4J dRrcLuKYm_3itjPekOjSlLDpcQ.s7SzPX9aOwEgxNgtK_CQRcn96rNyIJrMmwV15fsY.zJx255_D muph_lh0IcVrV6TgwSYdWknJ8VlZuylBFYLTdp8aKvkb_UvnQQ7h9lchZzacuOf.FosL4.zoTbvK Dub5iY7IFwonE4iKFifxdJJA.ahaRMEFk6tGjBg3PTcTe2Z9CbCOC70RwvYoqigY.7jcvuRCQ8yN VHI4- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Fri, 11 May 2018 00:30:48 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO [192.168.0.105]) ([67.169.65.224]) by smtp428.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 4ac9fcb9c658ae026a29fa3864c340a3; Fri, 11 May 2018 00:30:47 +0000 (UTC) To: LSM , LKLM , Paul Moore , Stephen Smalley , SE Linux , "SMACK-discuss@lists.01.org" , John Johansen , Kees Cook , Tetsuo Handa , James Morris Cc: Casey Schaufler From: Casey Schaufler Subject: [PATCH 00/23] LSM: Full security module stacking Message-ID: <7e8702ce-2598-e0a3-31a2-bc29157fb73d@schaufler-ca.com> Date: Thu, 10 May 2018 17:30:44 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Subject: [PATCH 00/23] LSM: Full security module stacking Here it is, the whole nine yards, broken into mostly review friendly pieces. I believe that it would make a good deal of sense to take this in two bites, with the infrastructure managed blobs going first and the secid conversion coming later. I hope there will be some debate around that. The blob management part is pretty clean by now. I welcome serious review on that. The secid part is more wobbly, but I am convinced that it's the right direction if not perhaps always the best possible implementation. AppArmor in in the process of a major overhaul, and that slowed me down a bit as I had to do new work to convert it to use the new mechanisms. I had experimented with secid "tokens" in the hope of minimizing API changes. That doesn't work. Changing the APIs to use a struct secids pointer in place of a u32 is brutal to the diffstat, but reduces the amount of active code that has to change, and really makes data management easier. If there are two possible ways to do a thing you will find them both in the networking code. AF_UNIX, netfilter, SO_PEERSEC and netlabel each has its own clever ways to manipulate security information. I think I nailed them all, but I'm not betting more than a beer on it. There could be issues in the audit code, although nothing jumped out immediately. The same goes for the integrity subsystem. I haven't tried Infiniband or very many filesystem types that don't com standard with Fedora or Ubuntu. I have fixed everything I've found. If you find something (please look!) let me know. Tested primarily on virtual machines. Fedora 25-27 - SELinux, Smack and the two together Ubuntu 17.04 - AppArmor and AppArmor + Smack The SELinux test suite completes successfully unless you add in Smack, in which case it fails where you would expect it to due to the different use models for netlabel. Smack tests work as well. AppArmor was tested by booting Ubuntu, but not beyond. Signed-off-by: Casey Schaufler --- Documentation/admin-guide/LSM/index.rst | 23 +- fs/btrfs/super.c | 10 +- fs/proc/base.c | 63 +- fs/proc/internal.h | 1 + include/linux/cred.h | 3 +- include/linux/lsm_hooks.h | 85 ++- include/linux/security.h | 211 +++++-- include/net/flow.h | 5 +- include/net/netlabel.h | 16 +- include/net/scm.h | 4 +- include/uapi/linux/netfilter/xt_SECMARK.h | 1 + include/uapi/linux/prctl.h | 4 + kernel/audit.c | 25 +- kernel/audit.h | 9 +- kernel/auditfilter.c | 4 +- kernel/auditsc.c | 44 +- kernel/cred.c | 19 +- kernel/fork.c | 3 + net/ipv4/cipso_ipv4.c | 19 +- net/ipv4/ip_sockglue.c | 6 +- net/netfilter/nf_conntrack_netlink.c | 22 +- net/netfilter/nf_conntrack_standalone.c | 11 +- net/netfilter/nfnetlink_queue.c | 14 +- net/netfilter/xt_SECMARK.c | 44 +- net/netlabel/netlabel_kapi.c | 52 +- net/netlabel/netlabel_unlabeled.c | 30 +- net/netlabel/netlabel_unlabeled.h | 2 +- net/netlabel/netlabel_user.c | 4 +- net/unix/af_unix.c | 19 +- net/xfrm/xfrm_policy.c | 5 +- net/xfrm/xfrm_state.c | 2 +- security/Kconfig | 80 +++ security/Makefile | 1 + security/apparmor/domain.c | 2 +- security/apparmor/include/cred.h | 24 +- security/apparmor/include/file.h | 9 +- security/apparmor/include/lib.h | 4 + security/apparmor/include/net.h | 10 +- security/apparmor/include/task.h | 22 +- security/apparmor/lsm.c | 131 ++-- security/apparmor/task.c | 6 +- security/integrity/ima/ima.h | 10 +- security/integrity/ima/ima_api.c | 5 +- security/integrity/ima/ima_appraise.c | 4 +- security/integrity/ima/ima_main.c | 22 +- security/integrity/ima/ima_policy.c | 11 +- security/security.c | 973 +++++++++++++++++++++++++++--- security/selinux/hooks.c | 658 ++++++++------------ security/selinux/include/audit.h | 2 +- security/selinux/include/objsec.h | 87 ++- security/selinux/include/xfrm.h | 9 +- security/selinux/netlabel.c | 33 +- security/selinux/selinuxfs.c | 5 +- security/selinux/ss/services.c | 13 +- security/selinux/xfrm.c | 29 +- security/smack/smack.h | 90 ++- security/smack/smack_access.c | 6 +- security/smack/smack_lsm.c | 673 ++++++++++----------- security/smack/smack_netfilter.c | 19 +- security/smack/smackfs.c | 32 +- security/tomoyo/common.h | 31 +- security/tomoyo/domain.c | 4 +- security/tomoyo/securityfs_if.c | 15 +- security/tomoyo/tomoyo.c | 57 +- 64 files changed, 2581 insertions(+), 1256 deletions(-)