Received: by 10.213.65.68 with SMTP id h4csp496224imn; Fri, 16 Mar 2018 09:30:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELtbSCd9rHgc/XfORgJ5IOeYfXbet0E+RMWSg+ht/4BUFLONO8AMAaJq5NCJrN+GanH9r14Y X-Received: by 2002:a17:902:8f97:: with SMTP id z23-v6mr2823093plo.162.1521217814571; Fri, 16 Mar 2018 09:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521217814; cv=none; d=google.com; s=arc-20160816; b=vLtxYINg3pBXoMMr3iCiDprdbUFZZhDKz1AzXnhpV1YIayzeZtD9XqYt57XvElOrQB pivi+f5wix06RbhnZ16UAmqfC9w0KvDYwQmFp7jVq+MPeUUSn+oTnueDiS2ZV6XBOBKV 57SwWNO9zaepdroWBNxF3VK0VUudEU/gvMmbI12QPKY+HKCq4VFYzzZShoICk5POwzke elTD9jIo1vJt3zVpZ+NqsSimOuBEGOryYfXa1/lUAACMxz12BDFjs3Z/3FlzokWOudwf w+FVS0n7Pn9PI1wLBZ8Y0tqpllgn2LHkvNoOb+J4CBJKMpqe6r1a4bPTwSpK8OLNm9sQ 2JOQ== 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=qXvf3SO8Ouc+UJeFb94Dfyh8mD4wC4WZxRb6ERRgI5M=; b=Jgzs/xqE8Qgpy0UfN+aKXZINusO9PbaWHCVDQrgIBGpirxLXc0wnrpDgioL9m1yAsS FSlMO0+oJAderoVAviKOfx0uhPBChHENTD66kJnd73iCoMWeiwO4913N/cy7i8cJ8JEI 4D1Vd7jeCen5ZQZB+HT5GtKjRSKlSVE//UpdHlr21GAv9Lbw58EL0Eoe6u4tCg8Yc/3m TcXUdC1ghgN6b+k7+HYBj1UvVk4SvolffuvswIKtFh5MDnMakefX+ocO/SkHL/n/jrbU b2JqKTWVuzwWH8psmvcKIFIOdcUqRbSh98pY7Ro9u1cDR2d9arljn/0fiEtZDXtnJzPK lQ4g== 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 u19si5705814pfk.128.2018.03.16.09.30.00; Fri, 16 Mar 2018 09:30:14 -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 S964893AbeCPPjH (ORCPT + 99 others); Fri, 16 Mar 2018 11:39:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43122 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933767AbeCPPjE (ORCPT ); Fri, 16 Mar 2018 11:39:04 -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 43BFC49F; Fri, 16 Mar 2018 15:39:03 +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.14 106/109] ima: relax requiring a file signature for new files with zero length Date: Fri, 16 Mar 2018 16:24:15 +0100 Message-Id: <20180316152335.598768675@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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; }