Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp721911pxu; Wed, 6 Jan 2021 02:35:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKKy8EU11axZn+fGR/QgophlFlvmB2NYreEGZCalr4TAzZW1mjegdndY+UAOcB3gPVHC9A X-Received: by 2002:a05:6402:1593:: with SMTP id c19mr3607030edv.269.1609929312863; Wed, 06 Jan 2021 02:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609929312; cv=none; d=google.com; s=arc-20160816; b=HeUGC5c/PCccfwROnj4tlYgIQNR2Be+dSAiF64a68PXg0AFh90/lZBdOIHDfXKgwwD SFgkiqGZPg7073bYaUkBC6mMJEqF91sydICVV4XvCHcKVUJpibeVsyCyZg+C08+FTuZH DBZDA5dKgvGbvNjN0wjq8NPf0QEgdGww/Oy1YyLfL2lXSp5CxBUB3sOaJeQsM8rW2utQ tfxng3f8Tv8sgthR4iHjnm0CpVHuYP/GxVkQEsbMH0mkXZBIO0+AsfFBJ6wbBbIOyAfj TRgU3fEI+WR/GRMVNqbv+QWkXwMB5CKa5aSlPt5Wj6jdDLtjn0W6EGWRKBU6bVKK/P8r Nb5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3QTzF15C6a5ZhbWKZ9FlnokHZBtieZ2ksQ1RkHwr5hU=; b=T5uyYb5gAwa4fqNcgGXS1YHkpKRmcWTyveX0P5+lt9uClJi6GZQSX55lJvyt13pFFq ADCedDWmpAQD7g4OpSgX/W7mRtV1H76B+Sj80oev9BHGNxMn5gcQp4x8Z/SQrDPFlgwF Dajk4vPduiMUTpLd+PxRmR4mf1N2RexcJo2TSFm5bLPWDEBEaZWtaYTHOAl1Ny4Y4Swt m0QTGDCiUYc6g/fe23NAos0Tt3oA0bfD87FYb4H9epgHwEXgiKc9KG3uLxLsNlOx36Yl 0A6/i9Y0QqkqRJ1AmixeFsFHD5spOeuhqnx/hV5c7ChDMJjPyC1tF4fBQgcDEh3F5Eoe LqTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qAGBatnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z26si801996edl.223.2021.01.06.02.34.47; Wed, 06 Jan 2021 02:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=qAGBatnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbhAFKdB (ORCPT + 99 others); Wed, 6 Jan 2021 05:33:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:58008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725971AbhAFKdB (ORCPT ); Wed, 6 Jan 2021 05:33:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B66D2310D; Wed, 6 Jan 2021 10:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609929140; bh=8orHryq6VnH6jtYez3tMeFosmYrZSBFx73SQxgbE9EA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qAGBatnSWl+hg9LtX0ozJrIWea13acKYZ1KBJtRAU+lEqkyf6KUqAgyfS/1lMljFe oghlrZJARLTTUAnpbCqJWJD12MYXH80mbHk69QBi6L/XS7evnTHiyZxRKj36MKxMSY kctCfaLutNwPPytJAqCp6a0Jp3533uXe/g+c7HJc= Date: Wed, 6 Jan 2021 11:33:39 +0100 From: Greg KH To: Siddharth Gupta Cc: mcgrof@kernel.org, rafael@kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Linux Kernel Mailing List , "psodagud@codeaurora.org" Subject: Re: PROBLEM: Firmware loader fallback mechanism no longer works with sendfile Message-ID: References: <7e6f44b1-a0d2-d1d1-9c11-dcea163f8f03@codeaurora.org> <180bdfaf-8c84-6946-b46f-3729d4eb17cc@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <180bdfaf-8c84-6946-b46f-3729d4eb17cc@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2021 at 05:00:58PM -0800, Siddharth Gupta wrote: > > On 1/4/2021 10:36 PM, Greg KH wrote: > > On Mon, Jan 04, 2021 at 02:43:45PM -0800, Siddharth Gupta wrote: > > > Hi all, > > > > > > With the introduction of the filesystem change "fs: don't allow splice > > > read/write without explicit ops"[1] the fallback mechanism of the firmware > > > loader[2] no longer works when using sendfile[3] from the userspace. > > What userspace program are you using to load firmware? > The userspace program is in the android userspace which listens to a uevent > from the firmware loader and then loads the firmware using sendfile[1]. > > Are you not using the in-kernel firmware loader for some reason? > We have certain non-standard firmware paths that should not be added to the > linux kernel, and the firmware_class.path only supports a single path. That option is just for a single override, which should be all that you need if the other paths that are built into the kernel do not work. Surely one of the 5 different paths here are acceptable? If not, how many more do you need? And last I looked, Android wants you to use the built-in kernel firmware loader, and NOT an external firmware binary anymore. So this shouldn't be an issue for your newer systems anyway :) > > > Since the binary attributes don't support splice_{read,write} functions the > > > calls to splice_{read,write} used the default kernel_{read,write} functions. > > > With the above change this results in an -EINVAL return from > > > do_splice_from[4]. > > > > > > This essentially means that sendfile will not work for any binary attribute > > > in the sysfs. > > Have you tried fixing this with a patch much like what we did for the > > proc files that needed this? If not, can you? > I am not aware of this fix, could you provide me a link for reference? I > will try it out. Look at the series of commits starting at fe33850ff798 ("proc: wire up generic_file_splice_read for iter ops") for how this was fixed in procfs as an example of what also needs to be done for binary sysfs files. thanks, greg k-h