Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1468431imm; Wed, 15 Aug 2018 19:01:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxfCQZw0IqDepEGES4+q/WyAZbDIoEcqzvbFDf8JHng6mPMqmZ7lbpc9EvyNQIXFdiEVudd X-Received: by 2002:a17:902:a50e:: with SMTP id s14-v6mr17037197plq.247.1534384880954; Wed, 15 Aug 2018 19:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534384880; cv=none; d=google.com; s=arc-20160816; b=MNScPesyw5FVsMKD+xXio9mlmHr+Ofg6cfp9Anf7sEvKwqFPZPPmIFmkjiCdLK8hG5 13wL3kuWgFVZV4xXumP+tk711qUJ65jKxnNe46PWZiXcdE0nf0oQ1pJmCQlmGkMkjqiF XL+ka7hrgXucpicZIUUTGE9Zo5xHv/xY4NPHj11ibEdHL7gmwKCKEVrCGuubnJcvm2lM fOvFJrd1Hi65N6AbGdvJE2Amvgv3JMPsdWL0dh1c/WLu/7it1XpPi4ryJG4SvDxh0MLt AOUjnhLfwXUjZAfK1xMy/RE7CiPmbSCZY1k682nptaRCaFWwc+YrBDGVpp7YHZZVas4v h7Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:arc-authentication-results; bh=1e7CMp9ZCan+JXKby3CG+VzGkNtqjw4+mdSX25Uhy3A=; b=My0Ln1dznfdCfyaUqVI0jnhUDo/lTrJbtGHeyqk4Y3gj34XWKmNsZAPS+yWOATNNKy 7ckRcrPVfXU1PFCRfv815l/mXXUdQut5n/TAv6fyb7SLKi6pktSO0nHWob6pSi9S+enM 4WGOqrgG1f5RWOnAyxd1jBfHm/vXrtUEYpKvcOMk1M5v9LortI35uCvsKRyJdpRTRe1k m3k4Nla2cyoSSHWPRYp5O9jRfjuyjziTskaSrBxpPJ/Plz3BtOtVM2UfudDq67lF+vys kmRp/8Ue/CB/8v26qvqtH03fsALu/gCIqaTXl6pcDUxZl2K5GvEkYalvakX6Kiv7QY6B wukA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k127-v6si155621pga.407.2018.08.15.19.00.52; Wed, 15 Aug 2018 19:01:20 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731203AbeHPCs2 (ORCPT + 99 others); Wed, 15 Aug 2018 22:48:28 -0400 Received: from mga09.intel.com ([134.134.136.24]:61123 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729147AbeHPCs1 (ORCPT ); Wed, 15 Aug 2018 22:48:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Aug 2018 16:53:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,245,1531810800"; d="scan'208";a="75694061" Received: from cschaufl-mobl.amr.corp.intel.com ([10.252.130.105]) by orsmga003.jf.intel.com with ESMTP; 15 Aug 2018 16:53:56 -0700 From: Casey Schaufler To: kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, SMACK-discuss@lists.01.org, casey.schaufler@intel.com, dave.hansen@intel.com, deneen.t.dock@intel.com, kristen@linux.intel.com, arjan@linux.intel.com Subject: [PATCH RFC 1/5] LSM: Introduce a hook for side-channel danger Date: Wed, 15 Aug 2018 16:53:51 -0700 Message-Id: <20180815235355.14908-2-casey.schaufler@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180815235355.14908-1-casey.schaufler@intel.com> References: <20180815235355.14908-1-casey.schaufler@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Casey Schaufler There may be cases where the data maintained for security controls is more sensitive than general process information and that may be subjected to side-channel attacks. An LSM hook is provided so that this can be check for where the system would take action should the current task have potential access to the passed task. Signed-off-by: Casey Schaufler --- include/linux/lsm_hooks.h | 7 +++++++ include/linux/security.h | 1 + security/security.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index a08bc2587b96..fd2a7e6beb01 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -698,6 +698,11 @@ * security attributes, e.g. for /proc/pid inodes. * @p contains the task_struct for the task. * @inode contains the inode structure for the inode. + * @task_safe_sidechannel: + * Check if a side channel attack is harmless for the current task and @p. + * The caller may have determined that no attack is possible, in which + * case this hook won't get called. + * @p contains the task_struct for the task. * * Security hooks for Netlink messaging. * @@ -1611,6 +1616,7 @@ union security_list_options { int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5); void (*task_to_inode)(struct task_struct *p, struct inode *inode); + int (*task_safe_sidechannel)(struct task_struct *p); int (*ipc_permission)(struct kern_ipc_perm *ipcp, short flag); void (*ipc_getsecid)(struct kern_ipc_perm *ipcp, u32 *secid); @@ -1897,6 +1903,7 @@ struct security_hook_heads { struct hlist_head task_kill; struct hlist_head task_prctl; struct hlist_head task_to_inode; + struct hlist_head task_safe_sidechannel; struct hlist_head ipc_permission; struct hlist_head ipc_getsecid; struct hlist_head msg_msg_alloc_security; diff --git a/include/linux/security.h b/include/linux/security.h index 3410acfe139c..69a5526f789f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -366,6 +366,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info, int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5); void security_task_to_inode(struct task_struct *p, struct inode *inode); +int security_task_safe_sidechannel(struct task_struct *p); int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); int security_msg_msg_alloc(struct msg_msg *msg); diff --git a/security/security.c b/security/security.c index 4927e7cc7d96..353b711e635a 100644 --- a/security/security.c +++ b/security/security.c @@ -1165,6 +1165,11 @@ void security_task_to_inode(struct task_struct *p, struct inode *inode) call_void_hook(task_to_inode, p, inode); } +int security_task_safe_sidechannel(struct task_struct *p) +{ + return call_int_hook(task_safe_sidechannel, 0, p); +} + int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag) { return call_int_hook(ipc_permission, 0, ipcp, flag); -- 2.17.1