Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421AbdGZRyz (ORCPT ); Wed, 26 Jul 2017 13:54:55 -0400 Received: from sonic317-30.consmr.mail.ne1.yahoo.com ([66.163.184.41]:33458 "EHLO sonic317-30.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751034AbdGZRyx (ORCPT ); Wed, 26 Jul 2017 13:54:53 -0400 X-Yahoo-Newman-Id: 721853.14506.bm@smtp115.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 6fXFxYQVM1kXRuBOthA_y7NlNIbUUpCVJ3o1fUvc4iZqhQ7 6gPkHnC7LRkvpkt1k3IOjk5JOjEA4h_ICsHCU7qGh6S4v1YlM69h9pZtMqaI vHnrQQUoiPb.wbe.48ub_4EBuqXZwxO57fjAvQhxIrUp3wj_LTuP6DmGFCLU tS4aUe52i7Yh3z02UU5_4Mwl.1DoAp2Q9CHfvvh.2TWDDrUqR4tueWkhxCBI UXOXuVoMIzO_G4uXchQ.gOVH4XaFR70bxVkFO5d0pWWgsex4AJD_kSYYmyzh vjAzEdIRaJ2zlKdeqwlOPyN_9PG5npxgxW8MryTNloPNBbmzRVn2sLxVmz7U zrB9IkjQpmuFR9ReDljtP7VSyR1zw8dgBRDi3yPB7ogKLk4Hm5QDXYc2jnOQ iMJkbyGlPrrFhgged7EEOKnDokjrfCYpMNQjpr4B3DXU_Nz1WXEu..cAIzjH b4mEnzcs1HpvqWDhhVmnI_4AK6c5PP5Y6Yv8ckJJkAnGnn.iyjYw1w5zAvie N37xdF2YhZ1ARxT2P8PP57P4qOLI3JrLR X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: Re: [PATCH v3 05/15] smack: Refactor to remove bprm_secureexec hook To: Kees Cook Cc: Andrew Morton , David Howells , "Eric W. Biederman" , John Johansen , "Serge E. Hallyn" , Paul Moore , Stephen Smalley , Tetsuo Handa , James Morris , Andy Lutomirski , Linus Torvalds , "linux-fsdevel@vger.kernel.org" , linux-security-module , LKML References: <1500416736-49829-1-git-send-email-keescook@chromium.org> <1500416736-49829-6-git-send-email-keescook@chromium.org> From: Casey Schaufler Message-ID: <16990524-73ab-b5e9-89d5-548be2d9aa9b@schaufler-ca.com> Date: Wed, 26 Jul 2017 08:24:52 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2610 Lines: 82 On 7/25/2017 8:58 PM, Kees Cook wrote: > On Tue, Jul 18, 2017 at 3:25 PM, Kees Cook wrote: >> The Smack bprm_secureexec hook can be merged with the bprm_set_creds >> hook since it's dealing with the same information, and all of the details >> are finalized during the first call to the bprm_set_creds hook via >> prepare_binprm() (subsequent calls due to binfmt_script, etc, are ignored >> via bprm->called_set_creds). >> >> Here, the test can just happen at the end of the bprm_set_creds hook, >> and the bprm_secureexec hook can be dropped. >> >> Cc: Casey Schaufler >> Signed-off-by: Kees Cook > How does this look to you, Casey? I've only got a few unreviewed > patches in this series. Two touch Smack. :) The eyes don't see any problems, but I haven't had a chance to try it out. > > Thanks! > > -Kees > >> --- >> security/smack/smack_lsm.c | 21 ++++----------------- >> 1 file changed, 4 insertions(+), 17 deletions(-) >> >> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c >> index 7d4b2e221124..4f1967be3d20 100644 >> --- a/security/smack/smack_lsm.c >> +++ b/security/smack/smack_lsm.c >> @@ -950,6 +950,10 @@ static int smack_bprm_set_creds(struct linux_binprm *bprm) >> bsp->smk_task = isp->smk_task; >> bprm->per_clear |= PER_CLEAR_ON_SETID; >> >> + /* Decide if this is a secure exec. */ >> + if (bsp->smk_task != bsp->smk_forked) >> + bprm->secureexec = 1; >> + >> return 0; >> } >> >> @@ -967,22 +971,6 @@ static void smack_bprm_committing_creds(struct linux_binprm *bprm) >> current->pdeath_signal = 0; >> } >> >> -/** >> - * smack_bprm_secureexec - Return the decision to use secureexec. >> - * @bprm: binprm for exec >> - * >> - * Returns 0 on success. >> - */ >> -static int smack_bprm_secureexec(struct linux_binprm *bprm) >> -{ >> - struct task_smack *tsp = current_security(); >> - >> - if (tsp->smk_task != tsp->smk_forked) >> - return 1; >> - >> - return 0; >> -} >> - >> /* >> * Inode hooks >> */ >> @@ -4646,7 +4634,6 @@ static struct security_hook_list smack_hooks[] __lsm_ro_after_init = { >> >> LSM_HOOK_INIT(bprm_set_creds, smack_bprm_set_creds), >> LSM_HOOK_INIT(bprm_committing_creds, smack_bprm_committing_creds), >> - LSM_HOOK_INIT(bprm_secureexec, smack_bprm_secureexec), >> >> LSM_HOOK_INIT(inode_alloc_security, smack_inode_alloc_security), >> LSM_HOOK_INIT(inode_free_security, smack_inode_free_security), >> -- >> 2.7.4 >> > > .