Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2275805pxy; Tue, 3 Aug 2021 02:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5gSQCb4ESbzoCOKo2WgSR6Pjlv/ii9jdNYOlItny05B7Gx2QHfIxntOch2BB4+DF+86QV X-Received: by 2002:a05:6402:1a4c:: with SMTP id bf12mr24678721edb.137.1627981864457; Tue, 03 Aug 2021 02:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627981864; cv=none; d=google.com; s=arc-20160816; b=AcML9+4W0nddQKe4GW7/TOTBpRRSH2qqqXeEjwqYfbd7kKJFmpiUN+his0jRzFuJ8q +QFpFT7De8uRGiveC1pw8k/B86yWWBx+BFTSENdPe6R/ZmY32lkBI6Z9OH40EfX/DHvR YPkKx3qwwSK8tqts/6lKDQOhZ5fu6jYTrHy5KiqRvmuM9qVxADceUQKI42fzYA/6mcdV TmUghbsHdHg9XC2/wYu9pcg89m0fur/2oHMCEiZ2pCp+3M5bZaaca14Mf/9bw1arWKpf ao9VWBD4rgWrACIO/AChqzirnZ4qeNbmKwZxMmm5cQOB4WIOr5Cgcme/mRIJcZqMpP9R +FtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PPERkJDmUqGoRJFFlz2gKtkglfVn/RWj0tAIej+ZdiE=; b=D4PVUurGbV/ZUNKh+ob0bly+VaxQ+RbiKPBV0hvBHmBaiMCQ26PYKVTZ6VAD3RpTLc ISm1IogVNlAMQ1nDO0qFCDXeCXFP4TW6d7Fk9/cYZv77wys19HMvJBVu2pQRerelsunr 3+6q5SXQbYp+f9UmWXCrl4aXXAjtstoXoZeyExOAPiKMUv4XrtogMZLlUmesjW873oGG LhxTl7b6QxWSGvmJX+CpP0IwcgGyQl5vyynPQEYKIDkNmNWzc+lSkD0Id+WtruNsd0y2 29CrcO5uADjjIXcXkKl6YawnAQJWHqb7PxSynehc1edWcSfegD9ZHclJWH3XfYAKS3Uq yc8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RRfnOeKl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si15821504edz.364.2021.08.03.02.10.40; Tue, 03 Aug 2021 02:11:04 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RRfnOeKl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbhHCJIe (ORCPT + 99 others); Tue, 3 Aug 2021 05:08:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234814AbhHCJIe (ORCPT ); Tue, 3 Aug 2021 05:08:34 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FBFC06175F for ; Tue, 3 Aug 2021 02:08:23 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id r6so15198785ioj.8 for ; Tue, 03 Aug 2021 02:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PPERkJDmUqGoRJFFlz2gKtkglfVn/RWj0tAIej+ZdiE=; b=RRfnOeKlylu8ywyvQb6H0cO0JtzkY429YJjwumfAFf/SZscQirLsajSf5EgYv2OhWq El+BUjtEFtcUKnb8LQHJUIkdSccZCEAekR984fMhJfaIs+Oo5IJzSuK4ha2cYZA0Abfv yR1boDQpLB3w44V+pyqykhPjYREzPCPFOzN0UL2nGkB92VQAW8lSmfAZUlQszGwvk9iE hp8ZO3kb2Xj76uy//HssJIQkcCQhbv2fJ2ZgqOjnsabOX8APjTMy+rMnXIDdoV9nhSoU LIrejgyCZpyOpATOn5nZV/JLAhcl0bpF+hAVvcGRloLJ6uaSrD0xfbSwQbuqLGSOAqhs VG+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PPERkJDmUqGoRJFFlz2gKtkglfVn/RWj0tAIej+ZdiE=; b=howlok290UPLhfeytbIBTVicWm+m7Zh2t9XJOiYByrIL0QMYEU6Zqe+gzEJ4MFzdcj gcunZan0jxAeoTIiQ3+EVhB66I/cnsC4xStUGJ03bt/o5vH8RALoKnnOhaSVkrFGOHfr 1VTelzSGTz5pbL264C6kbj4cM0LaVAcrdNJaxfmPZeQLu8bNXRDTNImJekjnKieIX8Nt n95xsCTQwLnBzx08geh5FiY1D5Vb3PQzXSDY5Ym9C3A9cLA6ZnFrPaTmtn+tCIRDoGeq g+8t5ckBqJ97ptcxBcEGMQE1htB2R+kNwD/WaeHRztQG0T846qPmkH75o48FDsLrUXLw OgIA== X-Gm-Message-State: AOAM530bno7FZZw7tx7qmBc/NTkxKZNkR7zSKvM/ic4lPyeTeEwZZ8sr zv6qw0Uv1byrRvZYZong8Ky0OiPq5S+u969nC3o= X-Received: by 2002:a02:908a:: with SMTP id x10mr17967649jaf.30.1627981702512; Tue, 03 Aug 2021 02:08:22 -0700 (PDT) MIME-Version: 1.0 References: <20210802214645.2633028-1-krisman@collabora.com> <20210802214645.2633028-7-krisman@collabora.com> In-Reply-To: <20210802214645.2633028-7-krisman@collabora.com> From: Amir Goldstein Date: Tue, 3 Aug 2021 12:08:11 +0300 Message-ID: Subject: Re: [PATCH 6/7] syscalls/fanotify20: Test file event with broken inode To: Gabriel Krisman Bertazi Cc: LTP List , Jan Kara , Ext4 , Khazhismel Kumykov , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Aug 3, 2021 at 12:47 AM Gabriel Krisman Bertazi wrote: > > This test corrupts an inode entry with an invalid mode through debugfs > and then tries to access it. This should result in a ext4 error, which > we monitor through the fanotify group. > > Signed-off-by: Gabriel Krisman Bertazi > --- > .../kernel/syscalls/fanotify/fanotify20.c | 38 +++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c > index e7ced28eb61d..0c63e90edc3a 100644 > --- a/testcases/kernel/syscalls/fanotify/fanotify20.c > +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c > @@ -76,6 +76,36 @@ static void trigger_fs_abort(void) > MS_REMOUNT|MS_RDONLY, "abort"); > } > > +#define TCASE2_BASEDIR "tcase2" > +#define TCASE2_BAD_DIR TCASE2_BASEDIR"/bad_dir" > + > +static unsigned int tcase2_bad_ino; > +static void tcase2_prepare_fs(void) > +{ > + struct stat stat; > + > + SAFE_MKDIR(MOUNT_PATH"/"TCASE2_BASEDIR, 0777); > + SAFE_MKDIR(MOUNT_PATH"/"TCASE2_BAD_DIR, 0777); > + > + SAFE_STAT(MOUNT_PATH"/"TCASE2_BAD_DIR, &stat); > + tcase2_bad_ino = stat.st_ino; > + > + SAFE_UMOUNT(MOUNT_PATH); > + do_debugfs_request(tst_device->dev, "sif " TCASE2_BAD_DIR " mode 0xff"); > + SAFE_MOUNT(tst_device->dev, MOUNT_PATH, tst_device->fs_type, 0, NULL); > +} > + > +static void tcase2_trigger_lookup(void) > +{ > + int ret; > + > + /* SAFE_OPEN cannot be used here because we expect it to fail. */ > + ret = open(MOUNT_PATH"/"TCASE2_BAD_DIR, O_RDONLY, 0); > + if (ret != -1 && errno != EUCLEAN) > + tst_res(TFAIL, "Unexpected lookup result(%d) of %s (%d!=%d)", > + ret, TCASE2_BAD_DIR, errno, EUCLEAN); > +} > + > static const struct test_case { > char *name; > int error; > @@ -92,6 +122,14 @@ static const struct test_case { > .error_count = 1, > .error = EXT4_ERR_ESHUTDOWN, > .inode = NULL > + }, > + { > + .name = "Lookup of inode with invalid mode", > + .prepare_fs = tcase2_prepare_fs, > + .trigger_error = &tcase2_trigger_lookup, > + .error_count = 1, > + .error = 0, > + .inode = &tcase2_bad_ino, Why is error 0? What's the rationale? Thanks, Amir.