From patchwork Fri Aug 17 22:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schaufler, Casey" X-Patchwork-Id: 10569401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CCF45A4 for ; Fri, 17 Aug 2018 22:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E4112BC8C for ; Fri, 17 Aug 2018 22:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F092BD2F; Fri, 17 Aug 2018 22:16:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 232C52BC8C for ; Fri, 17 Aug 2018 22:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbeHRBVg (ORCPT ); Fri, 17 Aug 2018 21:21:36 -0400 Received: from mga11.intel.com ([192.55.52.93]:58248 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbeHRBVf (ORCPT ); Fri, 17 Aug 2018 21:21:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Aug 2018 15:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,253,1531810800"; d="scan'208";a="67079632" Received: from cschaufl-mobl.amr.corp.intel.com ([10.254.9.75]) by orsmga006.jf.intel.com with ESMTP; 17 Aug 2018 15:16:26 -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 RFC v2 4/5] Smack: Support determination of side-channel vulnerability Date: Fri, 17 Aug 2018 15:16:23 -0700 Message-Id: <20180817221624.10232-5-casey.schaufler@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180817221624.10232-1-casey.schaufler@intel.com> References: <20180817221624.10232-1-casey.schaufler@intel.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Smack considers its private task data safe if the current task has read access to the passed task. Signed-off-by: Casey Schaufler --- security/smack/smack_lsm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 91750205a5de..85dc053e610c 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -2299,6 +2299,23 @@ static void smack_task_to_inode(struct task_struct *p, struct inode *inode) isp->smk_inode = skp; } +/** + * smack_task_safe_sidechannel - Are the task and current sidechannel safe? + * @p: task to check on + * + * A crude value for sidechannel safety is that the current task is + * already allowed to read from the other. + * + * Returns 0 if the tasks are sidechannel safe, -EACCES otherwise. + */ +static int smack_task_safe_sidechannel(struct task_struct *p) +{ + struct smack_known *skp = smk_of_task_struct(p); + struct smack_known *ckp = smk_of_task_struct(current); + + return smk_access(ckp, skp, MAY_READ, NULL); +} + /* * Socket hooks. */ @@ -4718,6 +4735,7 @@ static struct security_hook_list smack_hooks[] __lsm_ro_after_init = { LSM_HOOK_INIT(task_movememory, smack_task_movememory), LSM_HOOK_INIT(task_kill, smack_task_kill), LSM_HOOK_INIT(task_to_inode, smack_task_to_inode), + LSM_HOOK_INIT(task_safe_sidechannel, smack_task_safe_sidechannel), LSM_HOOK_INIT(ipc_permission, smack_ipc_permission), LSM_HOOK_INIT(ipc_getsecid, smack_ipc_getsecid),