Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3357548imm; Fri, 24 Aug 2018 15:44:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYdT373iP8pukkgxmSmm+54ODfOsU6lrpjVThJis1b0CrU+cVNZLielxT+6oFhMb0bUgUFm X-Received: by 2002:a63:b544:: with SMTP id u4-v6mr3430697pgo.247.1535150646152; Fri, 24 Aug 2018 15:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535150646; cv=none; d=google.com; s=arc-20160816; b=zagl8kWB99JW7XB5mc/j71MoHNBow3eI6nrAl8pLzzrwjyTZoSj28/y62F1crQwZ0a yVhfGTriSGVdeXDpDIl8vZXG2s8YpKluB7A0VkDT8pDeE0/X1Ax/t95J2q0LK9+mOxZP KfurZARk9Fp+kbwlFqd+5uR4d6qcC+t9bPPzZ4ssup/pkBzT+7PZ3SdputEXpo8dbS7V zRsivzK/ZxYebKzEFvaRrB2xQxUbC3RnJM+CvSLWEDivT945GQ1XrUSecD4ovYW0ocjW MVYthfnAptoKpXNxulxO2W8P8NncSKt4X5HNaFBN4l/XwP75Vm4/N0BWRBuzdPBP8ADk bHWw== 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=jh9MZFrTHJURAeEMQYv1SXWiO6+r/uxPuFJIZOBnG+I=; b=xxPZaOQVqFg1VLy5zkPZLSgG5jMr4ERwGewPGWOKOlbmqbvn7bmTqwUmte5xZ0rnxw fajXc/PqzPuo1z0gsASukQLDmYsXXNOAkLUFGMMSeosFL7rDfR0LnaU7YICcYRP53Cb2 FGYa69Y6HLrMX8ZzKfJmLiS8x4WANVySe5NZ0ZX/tYBvY1cCom+3v/eTbGC/HMYz48Rb Q0Fka9TjnfTorUXnYzvzVeiXzANEAesSRxvCxXl8WndZDwz5JfqafhHbLxNdknDsDrBK XsbnesjhvJkte1Gu/MNG2jY8hl78vGA4unuC7QPv+jHyboPT5GwskdntHZ+kkoLzawQU ZLJg== 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 e36-v6si7389036pgm.567.2018.08.24.15.43.51; Fri, 24 Aug 2018 15:44:06 -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 S1728033AbeHYCSY (ORCPT + 99 others); Fri, 24 Aug 2018 22:18:24 -0400 Received: from mga06.intel.com ([134.134.136.31]:59924 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727478AbeHYCSY (ORCPT ); Fri, 24 Aug 2018 22:18:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2018 15:41:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,284,1531810800"; d="scan'208";a="84307211" Received: from cschaufl-mobl.amr.corp.intel.com ([10.254.2.129]) by fmsmga001.fm.intel.com with ESMTP; 24 Aug 2018 15:41:18 -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, casey.schaufler@intel.com, dave.hansen@intel.com, deneen.t.dock@intel.com, kristen@linux.intel.com, arjan@linux.intel.com Subject: [PATCH v4 1/5] LSM: Introduce a hook for side-channel danger Date: Fri, 24 Aug 2018 15:41:13 -0700 Message-Id: <20180824224117.3356-2-casey.schaufler@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180824224117.3356-1-casey.schaufler@intel.com> References: <20180824224117.3356-1-casey.schaufler@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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