Received: by 10.213.65.68 with SMTP id h4csp1750002imn; Mon, 19 Mar 2018 12:13:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELsSNo+i9yKsD85FDmQ02TxM3ra1O18EayhyPFbQE/JsT4DDcjyrgKwbAvxyR/F9YKBAmqiC X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr13904596plg.41.1521486799284; Mon, 19 Mar 2018 12:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521486799; cv=none; d=google.com; s=arc-20160816; b=PIcnPDBzGqfwNA6n9VEBekUWHC85deqG7QvhKVP9XY1Llb+0xgTO3Dx6LvN5N3qT/S 6dKdROQF8T/O1QZ35BCnutFqRCkY8Tv4s/p88waXgQ3all61BIZbPAJzLfZL8dkHDYbb Bdnudp45xvM8w70k4ATzeO6DG1A0odZ6zaO1mZMeLBAobjdmRpfVXRURVgNT7tG0blUt unZqmf36OZFXYTZV7nBvp2kVvkUnapsUlCrOClzHkBe2PY2C4MzFPtKrFUo97vOs8uqi vqehhdBzyFL2qkgKOtvYvOL2mC4J8kgqa+qu89NkpVh48eRditZl83o6q4MXoHqGRuwB FBhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=238e+pUBZLi+e0KcfunEatJxo2lB0Ka5ELmp00TUWLw=; b=ZFtuDEaxcupi40F9EGiZd9+R2oL7ggSUaYg51esvBfwvCauftUxkZZlIuvZKAy81NH pWdEtWQIABYuAosVx9ONPEXryI6GpQzR9DFBNYBiu+44j7hwK8JlpfrABkvTvicgLeEt ceulcCo/MQAXDFyqTI8ObMXfqlG7K3M3sCOEtQLXOO6LzebdwYGrb22AHkFTaHLZm/sb 7aiqq8HfkIeZAfSPcvKzTTqsziqzPNSkhgHldVYmLnhmUBPfn9zWc9DLwERG0RLN1R3p WXPC9hgvQkM4GpGBStR24I2oo3jj7U1WQXaI00H2FnTjSImOKP9Z1YzcHGo/Ek80seq2 AwYg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si420694plr.440.2018.03.19.12.13.03; Mon, 19 Mar 2018 12:13:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031733AbeCSTLf (ORCPT + 99 others); Mon, 19 Mar 2018 15:11:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51188 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970007AbeCSS1W (ORCPT ); Mon, 19 Mar 2018 14:27:22 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 923B9126D; Mon, 19 Mar 2018 18:27:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mimi Zohar , Sasha Levin Subject: [PATCH 4.9 209/241] ima: relax requiring a file signature for new files with zero length Date: Mon, 19 Mar 2018 19:07:54 +0100 Message-Id: <20180319180759.828692103@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mimi Zohar [ Upstream commit b7e27bc1d42e8e0cc58b602b529c25cd0071b336 ] Custom policies can require file signatures based on LSM labels. These files are normally created and only afterwards labeled, requiring them to be signed. Instead of requiring file signatures based on LSM labels, entire filesystems could require file signatures. In this case, we need the ability of writing new files without requiring file signatures. The definition of a "new" file was originally defined as any file with a length of zero. Subsequent patches redefined a "new" file to be based on the FILE_CREATE open flag. By combining the open flag with a file size of zero, this patch relaxes the file signature requirement. Fixes: 1ac202e978e1 ima: accept previously set IMA_NEW_FILE Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- security/integrity/ima/ima_appraise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -207,7 +207,8 @@ int ima_appraise_measurement(enum ima_ho if (opened & FILE_CREATED) iint->flags |= IMA_NEW_FILE; if ((iint->flags & IMA_NEW_FILE) && - !(iint->flags & IMA_DIGSIG_REQUIRED)) + (!(iint->flags & IMA_DIGSIG_REQUIRED) || + (inode->i_size == 0))) status = INTEGRITY_PASS; goto out; }