From patchwork Mon Jul 11 19:30:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 9224015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08C5460572 for ; Mon, 11 Jul 2016 19:31:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB04C27DCE for ; Mon, 11 Jul 2016 19:31:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFA1C27E5A; Mon, 11 Jul 2016 19:31:05 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8229027DCE for ; Mon, 11 Jul 2016 19:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751051AbcGKTbE (ORCPT ); Mon, 11 Jul 2016 15:31:04 -0400 Received: from nm44-vm7.bullet.mail.bf1.yahoo.com ([216.109.115.31]:51795 "EHLO nm44-vm7.bullet.mail.bf1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbcGKTbD (ORCPT ); Mon, 11 Jul 2016 15:31:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1468265462; bh=uBhNIpMR+Dk/G95iTkw67m6U0XRIcVD7DBgEPDY0S2w=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=V/Stjn2au2kZLCPVrJTfvSazHWejG1uh8Z+o4/h8o2TSwsxTlcdDu91fPleMPYxRcXRnKWjUAS3H2/lRnIsut5Mkp4KAEA7OKZTk+xgMM1pBIV2/FdtZ/MIUQiPVVLwhBcvBtN+LkeQtl1E+BW2mA4APMB4NGQYt+UKyWaWCzxC8Xk+4hrAA94tbH0VNRyXqsjqqgRa4QOz1hVZSFKkpgZBusYImFUM3SZa6vXQ8JpYuusfL2bj8pgCeBm8aUcUg5xwCFCmLNONsnZwGgIeKIqsh1nDHNa66QsPVK8yFoSBpsLb1XZJgEMlV6wko0Pn+N2fwVIAjGbTqV+DQAl4wFQ== Received: from [66.196.81.170] by nm44.bullet.mail.bf1.yahoo.com with NNFMP; 11 Jul 2016 19:31:02 -0000 Received: from [98.139.211.200] by tm16.bullet.mail.bf1.yahoo.com with NNFMP; 11 Jul 2016 19:31:02 -0000 Received: from [127.0.0.1] by smtp209.mail.bf1.yahoo.com with NNFMP; 11 Jul 2016 19:31:02 -0000 X-Yahoo-Newman-Id: 2565.7116.bm@smtp209.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EJzNlsIVM1m9DhObpCZJ.iNZUODl6KfZoef8dpF6iE2IFNF MCAPgT6VMCbN7mkT3ou7wfs7qfLamE6r3jpOggOnjbArUtcgAKIyWovr0PaM sGgp6kAGBZFqm2DeXR2t3SIhxghHD0TSnh2fqzvcL7CpG9ovGO3TKD2rZB8c 8MHDqjZITh1AEuTF2lGavxWL2rmiSbUVwXDno8KYcUmjZUa.vxc0e1rxaC6R HpHszy_FC.oKMokLoEBeTSTWhF4qN7CBvXDmpnj5H9VjnElRyDtxzG3OJ7dD spIV8ZSPCKXVI4EiU4Dw2sxb8KkrcRr2nduSS72H6VKDItSQURMMG.lMp1rr 7FHlDGuVOjPs2FID6SehLmfk.ezbfswgVISCVwQgxIt2ZpYjnwTrMTmiz6uJ Da1KeFRN3o_IWUtxwylKDQHMjtP4JcOtzdUvR2e8HqT9P1DElybqGWYP1n.b XJkQWuWaOEjBJnnDdRqrIO8DcbRpNkOeDL5q4R4sw4BZdYleuEKka0IYLDyk qFOpEaJDqHX7Pl89zr51INpig.ia2RLBakEoHTsemFfXBASiaR_PPrZ2od_N cxmzOo75gh.Ql X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: [PATCH RFC 08/10] Smack: Abstract the file security blob To: LSM , James Morris References: Cc: John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley From: Casey Schaufler Message-ID: Date: Mon, 11 Jul 2016 12:30:56 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Subject: [PATCH RFC 08/10] Smack: Abstract the file security blob Abstract reading the file security blob. Remove abstraction when writing the file security blob. There is no change in the behavior of the code. Signed-off-by: Casey Schaufler --- security/smack/smack.h | 5 +++++ security/smack/smack_lsm.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/security/smack/smack.h b/security/smack/smack.h index a2a98c0..d929f3d 100644 --- a/security/smack/smack.h +++ b/security/smack/smack.h @@ -343,6 +343,11 @@ static inline struct task_smack *smack_cred(const struct cred *cred) return cred->security; } +static inline struct smack_known *smack_file(const struct file *file) +{ + return file->f_security; +} + /* * Is the directory transmuting? */ diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 7ab0021..bce7c44 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1817,7 +1817,7 @@ static int smack_file_send_sigiotask(struct task_struct *tsk, file = container_of(fown, struct file, f_owner); /* we don't log here as rc can be overriden */ - skp = file->f_security; + skp = smack_file(file); rc = smk_access(skp, tkp, MAY_WRITE, NULL); rc = smk_bu_note("sigiotask", skp, tkp, MAY_WRITE, rc); if (rc != 0 && has_capability(tsk, CAP_MAC_OVERRIDE))