Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1425583pxu; Thu, 17 Dec 2020 09:37:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIqVjsNBo/wLDab3EstFr81M1dAqmbL9BRkRsYpKPvuwMKNOIzYiEcYqh+fYk25gN9L3Lz X-Received: by 2002:aa7:da8f:: with SMTP id q15mr416109eds.239.1608226652538; Thu, 17 Dec 2020 09:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608226652; cv=none; d=google.com; s=arc-20160816; b=KxikuOQZExHE/C1/I8hFvF+i6KdvT6p9eKzev569D6+vQIXfIFgawBBautjZMUHvFD 0XCbAgSSkkTOUWVesM9LlkSqz3T3MY7mnQhrMrxUKJalVrr29AP0ViSGHsFRRqB93k7c xvNCIPWcDFQrhDzYgeG/MNAvx+z9/97jRALEZJekJKxyZ4TztQ9doovpXTSzAFSHlo4b FKtfyr4g5qz0pQFxHyT9eSbFQN5mqitKEtpkCl/6fCZ1hI6xzAvLKAxrmSVtELoZ5E5S fHGSEyf/v2+ZQY/QjKT9N4GNDSsBE21hb4gQOqehh5rd/Q6aSl8h+HOMq5subFDx8kY5 NCaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=G7pO/8u7GLc9Z5hWfxqgwvahacNxdouwtiJLyT02GfQ=; b=dYwt/G1+la/ZBO7rz6p0J1t3gofIxacEWt949uQJA3LSxFCyNiCn8VcP3TgcbKGwWc mNpHidplYC8PlavRKhc/+dz5NVmzz/xzk26fRC3M9ppGHjgNkINkIsETNQTDosrLrYWA GPDKVALpB2n1KSJV9fupyir7pg/FFJjMFl7vZZlysrWS5LNnbLAq1I1ZkuURrP4zH1PJ Y/rUDIwhhZO6immsWVRMAmLQkp2mTOdp4U9GSsjyN17aBTKqkbx93bVq1XZPYECacfgK ttyGemhar5iIw5kEvSsV0DLfFP3KCEJ67Z47hcRi1imuAoIimqiTOezG5PURQy2w0z0I et6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si4848598edy.595.2020.12.17.09.37.08; Thu, 17 Dec 2020 09:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728487AbgLQRgi (ORCPT + 99 others); Thu, 17 Dec 2020 12:36:38 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54792 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728143AbgLQRgg (ORCPT ); Thu, 17 Dec 2020 12:36:36 -0500 Received: from xps.home (unknown [IPv6:2a01:e35:2fb5:1510:779a:3a80:1322:d34a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aferraris) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 729F01F45D0A; Thu, 17 Dec 2020 17:35:54 +0000 (GMT) From: Arnaud Ferraris To: linux-ext4@vger.kernel.org Cc: drosen@google.com, krisman@collabora.com, ebiggers@kernel.org, tytso@mit.edu, Arnaud Ferraris Subject: [PATCH v3 10/12] e2fsck: Add option to force encoded filename verification Date: Thu, 17 Dec 2020 18:35:42 +0100 Message-Id: <20201217173544.52953-11-arnaud.ferraris@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201217173544.52953-1-arnaud.ferraris@collabora.com> References: <20201217173544.52953-1-arnaud.ferraris@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Gabriel Krisman Bertazi This is interesting for !strict filesystems as part of the encoding update procedure. Once the filesystem is known to not have badly encoded filenames, the update is trivial, thanks to the stability of assigned code points in the unicode specification. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Arnaud Ferraris --- e2fsck/e2fsck.h | 1 + e2fsck/pass2.c | 5 +++-- e2fsck/unix.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index dcaab0a1..f324e92c 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -177,6 +177,7 @@ struct resource_track { #define E2F_OPT_ICOUNT_FULLMAP 0x20000 /* use an array for inode counts */ #define E2F_OPT_UNSHARE_BLOCKS 0x40000 #define E2F_OPT_CLEAR_UNINIT 0x80000 /* Hack to clear the uninit bit */ +#define E2F_OPT_CHECK_ENCODING 0x100000 /* Force verification of encoded filenames */ /* * E2fsck flags diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index f23a3a9c..7e961e82 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1049,9 +1049,10 @@ static int check_dir_block(ext2_filsys fs, ctx = cd->ctx; /* We only want filename encoding verification on strict - * mode. */ + * mode or if explicitly requested by user. */ if (ext2fs_test_inode_bitmap2(ctx->inode_casefold_map, ino) && - (ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL)) + ((ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL) || + (ctx->options & E2F_OPT_CHECK_ENCODING))) cf_dir = 1; if (ctx->flags & E2F_FLAG_RUN_RETURN) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 1cb51672..0a9012e5 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -753,6 +753,9 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts) ctx->options |= E2F_OPT_UNSHARE_BLOCKS; ctx->options |= E2F_OPT_FORCE; continue; + } else if (strcmp(token, "check_encoding") == 0) { + ctx->options |= E2F_OPT_CHECK_ENCODING; + continue; #ifdef CONFIG_DEVELOPER_FEATURES } else if (strcmp(token, "clear_all_uninit_bits") == 0) { ctx->options |= E2F_OPT_CLEAR_UNINIT; @@ -784,6 +787,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts) fputs("\tbmap2extent\n", stderr); fputs("\tunshare_blocks\n", stderr); fputs("\tfixes_only\n", stderr); + fputs("\tcheck_encoding\n", stderr); fputc('\n', stderr); exit(1); } -- 2.29.2