Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6251584imm; Mon, 27 Aug 2018 12:19:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZeOxoXO2mKoaswiDWG/uinalYDdTt1Z9OKgZrQollsfim7xAh/JMd1c9RhWeHGpmkUsqoI X-Received: by 2002:a17:902:3124:: with SMTP id w33-v6mr14467100plb.235.1535397592638; Mon, 27 Aug 2018 12:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535397592; cv=none; d=google.com; s=arc-20160816; b=G+ZczAQv42mGbkdKiBcWeSng9h4pndXkh8G5EE3MUf5ELQR5UT6JwJ5uRo72EIwixt 5q2XIuyjLLzRApKfZVe8888tVxKMM7GzfbX6NNftel/JOiqrKPf8RLhCfVKrkRhI6QYI eaUlVtZhVrObp4odPNloiuJbIjJymrbQTitf/06dhdZSuFLp3IeAfe7XIItUkUsQcNCo GumJW8j/N0R8hecd67veL7+GjTk5z7tBBEQmWHaecldqcBerRbMwW/9pJ4hJfMN05YGJ 6yo+GD7KGxj4whvNRQUYAw0NXf8cZ+XNrDtJkkN5bZqKoif2Feb0Bu3n1qp2SB+grhgD wOCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ogXZknzh0Y7pt4qzOu+3cYcBP+94sri97etv0QwY5s4=; b=MuYQoc+dL4reI79WPovkp8Je4D2sI7dNCFE9sC/lnKfZ29TUvXaU5EKpC8xW62dj/r v5eCDAWLD9t5A8DaSrk3Rjk8IeB+RYMshNgMWQ+jSE3UnXsleg6bA6c2gQxTzLouJWUY hWjWNjgtKvRyjFkmQA+veNlbsCR+3SUs4kOgaAmul+L5ZYZY76RnmjBX6lbUd5ypahMn j8frmxm8yGZW6w/6UIU2Md0zno+wPAPENueeZ1yl4o0NvFe1S7kLOgMXK8zsA+unkTU3 PRuUAC5F5qpAgS3DmHEtZIeLVzChfvLSzKYPJJ8opPWsJkqa+PwAKeHM1eqj3hWrHLxg /A+w== 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 c10-v6si15024plr.155.2018.08.27.12.19.36; Mon, 27 Aug 2018 12:19:52 -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 S1727077AbeH0XGW (ORCPT + 99 others); Mon, 27 Aug 2018 19:06:22 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:34534 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727005AbeH0XGW (ORCPT ); Mon, 27 Aug 2018 19:06:22 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 67432606D4A7; Mon, 27 Aug 2018 21:18:26 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id K5uRc8nUl_qN; Mon, 27 Aug 2018 21:18:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 109F7603B56E; Mon, 27 Aug 2018 21:18:26 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XFyZhlcCEQMF; Mon, 27 Aug 2018 21:18:26 +0200 (CEST) Received: from blindfold.localnet (213-47-184-186.cable.dynamic.surfer.at [213.47.184.186]) by lithops.sigma-star.at (Postfix) with ESMTPSA id BE129608D734; Mon, 27 Aug 2018 21:18:25 +0200 (CEST) From: Richard Weinberger To: Sascha Hauer Cc: linux-mtd@lists.infradead.org, David Gstir , kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH 12/25] ubifs: Add hashes to the tree node cache Date: Mon, 27 Aug 2018 21:18:25 +0200 Message-ID: <3260968.WmIi4lir0Q@blindfold> In-Reply-To: <20180704124137.13396-13-s.hauer@pengutronix.de> References: <20180704124137.13396-1-s.hauer@pengutronix.de> <20180704124137.13396-13-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Mittwoch, 4. Juli 2018, 14:41:24 CEST schrieb Sascha Hauer: > As part of the UBIFS authentication support every branch in the index > gets a hash covering the referenced node. To make that happen the tree > node cache needs hashes over the nodes. This patch adds a hash argument > to ubifs_tnc_add() and ubifs_tnc_add_nm(). The hashes are calculated > from the callers of these functions which actually prepare the nodes. > With this patch all the leaf nodes of the index tree get hashes, but > currently nothing is done with these hashes, this is left for a later > patch. > > Signed-off-by: Sascha Hauer > --- > fs/ubifs/journal.c | 93 ++++++++++++++++++++++++++++++++++------------ > fs/ubifs/replay.c | 4 +- > fs/ubifs/tnc.c | 10 ++++- > fs/ubifs/ubifs.h | 7 +++- > 4 files changed, 84 insertions(+), 30 deletions(-) > > diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c > index 754d969eb27e..55b35bc33c31 100644 > --- a/fs/ubifs/journal.c > +++ b/fs/ubifs/journal.c > @@ -517,6 +517,9 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, > struct ubifs_dent_node *dent; > struct ubifs_ino_node *ino; > union ubifs_key dent_key, ino_key; > + u8 hash_dent[UBIFS_MAX_HASH_LEN]; > + u8 hash_ino[UBIFS_MAX_HASH_LEN]; > + u8 hash_ino_host[UBIFS_MAX_HASH_LEN]; With authentication enabled, this makes perfectly sense. But if someone builds UBIFS without and has a memory constraint system, we could save by setting UBIFS_MAX_HASH_LEN to 0. What do you think? Although, we need another define to not influence ubifs-media.h. Thanks, //richard