Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp644761imu; Wed, 9 Jan 2019 04:06:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7RASIe9NvO3o3qxv91D7mPB/peJ6EOS7bK50LG3X58f4Bpf6LImPloMC4ghRBqXXGjt3lP X-Received: by 2002:a63:a064:: with SMTP id u36mr5173211pgn.145.1547035578169; Wed, 09 Jan 2019 04:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547035578; cv=none; d=google.com; s=arc-20160816; b=QXcrx/LQLEipX/S2e//SXnJDW6KsbJKK0amgY46YUpKvrYecg7I/6c8GHwZ5cqZGSf M/IAX11B4Ocgnn5hfIz/YTertXLuGG+vbgkuqmPmp/ufhJD3zL/6Zlil+BWxh+QYZy3v /cArrODuPEf01PTBevidx1Zjd5ItWVZzHeYA+W5gymYmQ3jGYV107bRnTCM97GuTtPjV Q6zpJNuKSDURe08ZgbJf0/y6lOvk1pvw48bdtNR+AIqlHZsF2QpX1UboZ19KJrqt5rjZ BKqEgdGaow00qxVhJfS0XRhEbLRedGQHF/5ayXeWaAW2fk4KTA7gQS2Xqa3OsveJyDdj nrnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=olGvsRv7Ef2v/S+9MHxMLzfvYKDV8x9VBndOX98DBhM=; b=xIkg+rdfljtiLfg5U9L6ntgjenildIWc+tZG/Ug9KLHpMBVDWfLKYa1YLTu1CPvnLP fSL43j+eDqCkifSi6a8AfnBL1SmMsSTJusZwJAP+bI+xaHZc6G57wqy2AIpNSaaBWsZd UZNTeOfp4wxGgK04I9NWhCe3UA4M7w+P6dtKh3Pg7AOi2mVWjA9UecvoNjQQrz8BY7kl czMkm9NhW7L1gDEYgM3PXwl6A/tvF/Jg9wl/N52WrcEze9R9u23e8C95zmOTFH2DFn4R 8YGNq9I02ySjyiR2xQrO6yobyMzlVxZUQ0Ij0/ShFbWLXHPKIt72lLQjFekox6J5ZjtA uhpg== 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 b14si2867839pfc.156.2019.01.09.04.06.02; Wed, 09 Jan 2019 04:06:18 -0800 (PST) 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 S1730815AbfAILcq (ORCPT + 99 others); Wed, 9 Jan 2019 06:32:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:57338 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730111AbfAILcq (ORCPT ); Wed, 9 Jan 2019 06:32:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BECEBAEA3; Wed, 9 Jan 2019 11:32:43 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 9F36D1E157B; Wed, 9 Jan 2019 12:32:42 +0100 (CET) Date: Wed, 9 Jan 2019 12:32:42 +0100 From: Jan Kara To: Amir Goldstein Cc: Sasha Levin , linux-kernel , stable , Matthew Bobrowski , Jan Kara , linux-fsdevel Subject: Re: [PATCH AUTOSEL 4.20 016/117] fanotify: return only user requested event types in event mask Message-ID: <20190109113242.GE15397@quack2.suse.cz> References: <20190108192628.121270-1-sashal@kernel.org> <20190108192628.121270-16-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 09-01-19 08:50:33, Amir Goldstein wrote: > On Tue, Jan 8, 2019 at 10:11 PM Sasha Levin wrote: > > > > From: Matthew Bobrowski > > > > [ Upstream commit 2d10b23082a7eb8be508b3789f2e7250a88a5ddb ] > > > > Modify fanotify_should_send_event() so that it now returns a mask for > > an event that contains ONLY flags for the event types that have been > > specifically requested by the user. Flags that may have been included > > within the event mask, but have not been explicitly requested by the > > user will not be present in the returned value. > > > > As an example, given the situation where a user requests events of type > > FAN_OPEN. Traditionally, the event mask returned within an event that > > occurred on a filesystem object that has been marked for monitoring and is > > opened, will only ever have the FAN_OPEN bit set. With the introduction of > > the new flags like FAN_OPEN_EXEC, and perhaps any other future event > > flags, there is a possibility of the returned event mask containing more > > than a single bit set, despite having only requested the single event type. > > Prior to these modifications performed to fanotify_should_send_event(), a > > user would have received a bundled event mask containing flags FAN_OPEN > > and FAN_OPEN_EXEC in the instance that a file was opened for execution via > > execve(), for example. This means that a user would receive event types > > in the returned event mask that have not been requested. This runs the > > possibility of breaking existing systems and causing other unforeseen > > issues. > > > > To mitigate this possibility, fanotify_should_send_event() has been > > modified to return the event mask containing ONLY event types explicitly > > requested by the user. This means that we will NOT report events that the > > user did no set a mask for, and we will NOT report events that the user > > has set an ignore mask for. > > > > The function name fanotify_should_send_event() has also been updated so > > that it's more relevant to what it has been designed to do. > > > > Signed-off-by: Matthew Bobrowski > > Reviewed-by: Amir Goldstein > > Signed-off-by: Jan Kara > > Signed-off-by: Sasha Levin > > --- > > I have no objection to applying this patch to 4.20, but FYI, it does not > fix anything. Before introducing FAN_OPEN_EXEC in 5.0-rc1, this patch > has no visible effect. Yes, the patch is just a code refactoring useful for the FAN_OPEN_EXEC feature. > I don't mind if you apply it. It will make stable code closer to > mainline, which is always a good thing IMO. And FWIW, I think that patch > is quite trivial and low risk. I don't think applying code refactoring to stable is a good idea. Every change has a risk of regression and this particular one brings users no benefit. So I'd prefer to drop this patch from stable queue. Honza -- Jan Kara SUSE Labs, CR