Received: by 10.213.65.68 with SMTP id h4csp472795imn; Fri, 16 Mar 2018 08:49:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELuFWTnVdfeXeP/u8u64wRRHM5Q59VkulPK8TZLVC5r7/eQUzLZJpXyVvPLcSDUMr2GfoWKu X-Received: by 2002:a17:902:5993:: with SMTP id p19-v6mr2598060pli.347.1521215345435; Fri, 16 Mar 2018 08:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215345; cv=none; d=google.com; s=arc-20160816; b=jypI5nIKwloj3f0LC07gL4Lu5MUhJ82dDy8HhzQlFjFC9pk3BmcjKna1fSuObm9vmx fVql2F0+vIIXewf6L8KoVBGqVrImHJImw3F/YRcttXlu/66ZegLMphEsbyUiqPLGI1ai Px7701OMI7bTlUV83zO2jlUMp4RbZl66lpWeKC7hKj5FuexdglIMf5jJU3g587gRcS27 Gh2J7VmOMZ7nsYzvvc2MNhnGGtwE64hsFwZdC+MQxUXGfhzuTz50E83Bd/D0PscekBg5 m8ESY+2+LUmjapZ74UzeK2h75/N4ljaRRS3xbj1RcLPzH9BmWn8Zpb28c71eTWbklObo +94A== 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=Y1KrCxjOhUkPSC/pPXwOlsX5/xWZiULxui3WHIZC2HA=; b=pUDQG9pWDdFzYYkLCaaJhJvnBZdsWsSoAUhvoy8JPhTtqLW1JHVd7rgynIoWPCYTQ9 35+inJYLoxWFNUF+AvN8CwiRp1WofzfkP7m9DqTgP8bowkBjHmQJQ4kkptb/ZlLE4uoM DT9n1XK8G7hmbTOMNVFUF3QfbKY1Ct2jQOgfMmSgXh6VOCvoNsffCdm69I7jHxnPVUvZ EiWPhSw2yUY5GecgFu/75etB5yn7v/zXOexRiuh1NzIETn+gORuedX4gdUCY9BE6hZW2 lsu4QU5BBXvzIPQ7laNXrHxl5a2GiQBx3edBvjSF+epYtNwwACOhPzXqdm2gUNYIUfFj CVkg== 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 u27si5676841pfk.241.2018.03.16.08.48.48; Fri, 16 Mar 2018 08:49:05 -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 S965489AbeCPPoy (ORCPT + 99 others); Fri, 16 Mar 2018 11:44:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46140 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965458AbeCPPov (ORCPT ); Fri, 16 Mar 2018 11:44:51 -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 56A54E40; Fri, 16 Mar 2018 15:44:50 +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.15 125/128] ima: relax requiring a file signature for new files with zero length Date: Fri, 16 Mar 2018 16:24:26 +0100 Message-Id: <20180316152342.663901260@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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 @@ -223,7 +223,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; }