Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2268937pxy; Tue, 3 Aug 2021 01:58:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNSmWfCS2M5eZ6QtcfWXJMz1z6xmhNweiWg2DV0G+bBGyCUx4NNxY4KUg+Ol0oJTkm+h8M X-Received: by 2002:a05:6e02:b4b:: with SMTP id f11mr260083ilu.130.1627981086764; Tue, 03 Aug 2021 01:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627981086; cv=none; d=google.com; s=arc-20160816; b=OtSm5GKRS1ECGJxrsl4gsmUjwhtP9S7a3b8E596DX72+/CJZdJmRCYQGgF9kDvqbEH hx9sRR4sOc6MnjV08jSywkDOB726W7Xqo60aLiaPDVHC6C5UOxTTxGpJ/xqlBzU03kb9 O+ezqowkNear8tWeYqezZwZ9U8jqdQr9xIYQFQ70omWmgly8arSAwE3Gs1ZnshS686KC LTcogwB7XtQkRsD5oqAtpg2qn/xHxw1E6ecIEQYQwWbbkwwYtnWeGNeH9UoEMjMLXoUX SQQIw1FiV2aU2X9jntwNCbT4zQZkAVKZfyB5nWFJp83cvc0g0ntjYnXz0DDQodPCcTAT WiEw== 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=7SsFV2iOXhu6gJLnc6G6fBI8/OQbVqmopZT5kD/FcIs=; b=NYjlkJgbOduE9hTnfGVLqiHJuI57VxuONaHbk5IoDxbzaQO7V4A3FU5sTlCX+Vuw3b fG/UiOJ4honAxEKbJUrGRpNGsUhgMlt9VAZJCPiEJ+CHRGVPL2FbglVuqf83xLbwq45h iy78HihKh5G3UlslZUmw5PmjkXVKjnYRtxMgldh66GZPLgrd8D+wG1JFKJ8bbnbWxBtO 3u7A64rJvTH4E/oHja1K1gsyQcbcziF67uK8Bl+QE8b5VQrQunea666s0xzG+UnPsZdy xwOJsAKtQ3CpFMYhhfLZbF0jhLe2beDpashq3Yq57H+qcM50LfMo2zGc7K3DxVp2GiiS QH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hahqrRRS; 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 l8si7485910jap.104.2021.08.03.01.57.50; Tue, 03 Aug 2021 01:58:06 -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=hahqrRRS; 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 S234714AbhHCI4x (ORCPT + 99 others); Tue, 3 Aug 2021 04:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234579AbhHCI4x (ORCPT ); Tue, 3 Aug 2021 04:56:53 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD35BC061764 for ; Tue, 3 Aug 2021 01:56:42 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id z7so22621149iog.13 for ; Tue, 03 Aug 2021 01:56:42 -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=7SsFV2iOXhu6gJLnc6G6fBI8/OQbVqmopZT5kD/FcIs=; b=hahqrRRSNDxZMk6jEqqdCYQMZnmFhozTgz/v2l2OyEpN0XE9axp4g+uUg0B4IVXtJl F8FojYZGy7QoKv/o8/73A+2islxAtMxqrWMb0vHD0d5rixpjAWEwIOlA8uA7ClO4eOtH v0WfzPwU+iE+doh5PSZDmUV6dFXL9OIR0cV3p1ehfyw0azdChf3HbahiTMbi1N/PKZks WXJfjhngcQa70rOz3AVDuROoTuHCogbGDL3nnpogMQh0fINLmn6ZiZQDw2hRxGH7Pe4K JeIGAXr/FRFQ+yBHyVYmbjmRzsuRA/q5XVIj1y3pzhmLI+eEA7ge+hA2IJu/rXe6we8E yQyg== 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=7SsFV2iOXhu6gJLnc6G6fBI8/OQbVqmopZT5kD/FcIs=; b=SP/o8gNzHpE2VyNPNpBr/YeZ/ZUVwri3dejDKSkrDYfifKWMs4j9refHF6mFB4D+cR tIKpcQWHAxURrhAI9fUHYlpjjVWQf4CxL8SukuDAJoi6fbnwGn3BQfZaI1vxy0h27MDz PYqkJBjvAuyvv0kD1qdWV0JdfiNc8Fcj2qihAjXnMA47kdM62br8VAnlbREWu6RGr960 /7hwtWrJZW+Z2IS97w5Bp2/+BCJnmMUNdBqdh+QG7ort7PLOWaNGi8oIh3JDYdJFN8nL Wc40yJSbZaxjS6r8YZW78u6CiszzoCMNfJjwz7NaPfC2fsumHo+04RGH3Zt39SJVURir IzIQ== X-Gm-Message-State: AOAM533QjtA29CENPUxzmUVVs+ovkrDgXI5dzTrEgHXdYnKJeLT6VA84 mtIn4SyIxNwGA2wHxo8YgaPalQwQRhLP0JLN0Ok= X-Received: by 2002:a05:6638:1928:: with SMTP id p40mr4348179jal.93.1627981002326; Tue, 03 Aug 2021 01:56:42 -0700 (PDT) MIME-Version: 1.0 References: <20210802214645.2633028-1-krisman@collabora.com> <20210802214645.2633028-4-krisman@collabora.com> In-Reply-To: <20210802214645.2633028-4-krisman@collabora.com> From: Amir Goldstein Date: Tue, 3 Aug 2021 11:56:31 +0300 Message-ID: Subject: Re: [PATCH 3/7] syscalls/fanotify20: Validate incoming FID in FAN_FS_ERROR 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: > > Verify the FID provided in the event. If the testcase has a null inode, > this is assumed to be a superblock error (i.e. null FH). > > Signed-off-by: Gabriel Krisman Bertazi > --- > .../kernel/syscalls/fanotify/fanotify20.c | 51 +++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c > index fd5cfb8744f1..d8d788ae685f 100644 > --- a/testcases/kernel/syscalls/fanotify/fanotify20.c > +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c > @@ -40,6 +40,14 @@ > > #define FAN_EVENT_INFO_TYPE_ERROR 4 > > +#ifndef FILEID_INVALID > +#define FILEID_INVALID 0xff > +#endif > + > +#ifndef FILEID_INO32_GEN > +#define FILEID_INO32_GEN 1 > +#endif > + > struct fanotify_event_info_error { > struct fanotify_event_info_header hdr; > __s32 error; > @@ -57,6 +65,9 @@ static const struct test_case { > char *name; > int error; > unsigned int error_count; > + > + /* inode can be null for superblock errors */ > + unsigned int *inode; Any reason not to use fanotify_fid_t * like fanotify16.c? Thanks, Amir.