Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp495095pxb; Tue, 19 Oct 2021 07:10:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEvjIW5R/zc0Tg1y7UI6NtijiQBVG5CXXXpnphpfs7d+BRaBGdG9XTEH76KHIMdRA6rvyF X-Received: by 2002:a05:6a00:23d3:b0:44c:a67f:49af with SMTP id g19-20020a056a0023d300b0044ca67f49afmr22366pfc.50.1634652613659; Tue, 19 Oct 2021 07:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634652613; cv=none; d=google.com; s=arc-20160816; b=NNKda+pQE3AGeCfOQ1vp9ClvGoN/jSHtFxPMdkmHUuwzWz64ti7+z+NxE8GeSp+tHS KHtcyT/ihDIf30UI4ZTKMKhRq84CWxyS5uKh0+P+5srTWsAR72Ng63QMW614Udq/VaPK muQJzWqqISk0fFGiOe8faoxUlfada5I0Z41wSVpGhPQp8I2pzzNt2Dyn1+6hr1isnxlU 0y75LK6uLs/cG+81hLI/JE9Xp8VN+kx/TVbakJAw7nHeT+WLSXFtWfE3aGDqOa7MYdU+ ZcFMWeHKkV0IE8LTN1PoVxksUix4WZ1okDRp/bAhgy8zaRe9aWHj9uoYKMBF+glAnjz7 n3Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=nzjOyBQvl4mFaSHeEvZB3Ixi5wIxP+tZP4qGDw8BtrM=; b=gNBlncFITUTPcWNDID7PuOa1MNef5fMe7z/dbYF6mUkXELxXB5LkMxOq9zhKb/5m9u zPLld/EH607KpmJKF95L11ygM3xBQPMWpN4S2MojZo/ue6b0VTsB5dKaE5h0ADio2Yx0 0nQoi/3/Tx4epBJYzfV3mFkJ6JIXi7eDgymXy9WN5sOFq7Wr6/IyAMgGDChTG7rI3EBm qIb2iO2V2clOat2Gy3iDq2Sm/VbpbD9TCyQhLCjci7cidSZvvGx1PIUbgQFLOpZo9Fkn BN1RvkqTMKehF5gGnKzaHrtRheBHFcX9qD8uwZWm7zy19jorgjEAB7zpmtu2601R20iH 0rGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=jHeXI5GP; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk12si4642075pjb.183.2021.10.19.07.09.44; Tue, 19 Oct 2021 07:10:13 -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=@suse.cz header.s=susede2_rsa header.b=jHeXI5GP; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbhJSOLA (ORCPT + 99 others); Tue, 19 Oct 2021 10:11:00 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:60056 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232615AbhJSOK7 (ORCPT ); Tue, 19 Oct 2021 10:10:59 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E49231F782; Tue, 19 Oct 2021 14:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634652525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nzjOyBQvl4mFaSHeEvZB3Ixi5wIxP+tZP4qGDw8BtrM=; b=jHeXI5GPzZbX75Vns+swZFfKPw52SfpvhDbMpzO+FE+SCkT6e3x261TuPnw2yeyck75xc5 t5gv7oPU3oc0EOZorFylhNcSCGNgaLbcKP2doG6dwP9QUNYHiEHkMSgZeDr5Uixuhen1v1 kSedkaoQBHK+5e+i52UVdKipNGLXQbI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634652525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nzjOyBQvl4mFaSHeEvZB3Ixi5wIxP+tZP4qGDw8BtrM=; b=UDQaMGrwRnMj6aWHqezTvN0YMBfxCyAiZWXjfJV71V1p+TS8/QMBBNMekmCS2zJsOtqgjw GKjTFSBv4FZBkSAw== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id D5B4CA3B85; Tue, 19 Oct 2021 14:08:45 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id BE2971E0983; Tue, 19 Oct 2021 16:08:45 +0200 (CEST) Date: Tue, 19 Oct 2021 16:08:45 +0200 From: Jan Kara To: Gabriel Krisman Bertazi Cc: jack@suse.com, amir73il@gmail.com, djwong@kernel.org, tytso@mit.edu, david@fromorbit.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, kernel@collabora.com Subject: Re: [PATCH v8 25/32] fanotify: Report fid entry even for zero-length file_handle Message-ID: <20211019140845.GO3255@quack2.suse.cz> References: <20211019000015.1666608-1-krisman@collabora.com> <20211019000015.1666608-26-krisman@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019000015.1666608-26-krisman@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon 18-10-21 21:00:08, Gabriel Krisman Bertazi wrote: > Non-inode errors will reported with an empty file_handle. In > preparation for that, allow some events to print the FID record even if > there isn't any file_handle encoded > > Even though FILEID_ROOT is used internally, make zero-length file > handles be reported as FILEID_INVALID. > > Signed-off-by: Gabriel Krisman Bertazi I suppose you need to move fanotify_has_object_fh() change from patch 27 here. Otherwise the change looks good so feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/notify/fanotify/fanotify_user.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > index ae848306a017..cd962deefeb7 100644 > --- a/fs/notify/fanotify/fanotify_user.c > +++ b/fs/notify/fanotify/fanotify_user.c > @@ -339,9 +339,6 @@ static int copy_fid_info_to_user(__kernel_fsid_t *fsid, struct fanotify_fh *fh, > pr_debug("%s: fh_len=%zu name_len=%zu, info_len=%zu, count=%zu\n", > __func__, fh_len, name_len, info_len, count); > > - if (!fh_len) > - return 0; > - > if (WARN_ON_ONCE(len < sizeof(info) || len > count)) > return -EFAULT; > > @@ -376,6 +373,11 @@ static int copy_fid_info_to_user(__kernel_fsid_t *fsid, struct fanotify_fh *fh, > > handle.handle_type = fh->type; > handle.handle_bytes = fh_len; > + > + /* Mangle handle_type for bad file_handle */ > + if (!fh_len) > + handle.handle_type = FILEID_INVALID; > + > if (copy_to_user(buf, &handle, sizeof(handle))) > return -EFAULT; > > -- > 2.33.0 > -- Jan Kara SUSE Labs, CR