Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2549492pxu; Fri, 9 Oct 2020 22:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxp2j7b68rNs+48vDeF+HXcqGckvbns5oBwcH5ti/DyNZtc/wSTtMXvmUBu6WmJw2VzsKTU X-Received: by 2002:a50:d796:: with SMTP id w22mr2923134edi.123.1602308362165; Fri, 09 Oct 2020 22:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602308362; cv=none; d=google.com; s=arc-20160816; b=upBP7lpCMUx78TxEXCLwepiGgl8X2SYfc5GtRROuDvmDF+knMSrrAatOZ2dxwF4AHB 5GThTeDvfb8O8xDH0c+NnKht5UeiE9i6eHYCAXnbY3cVEopaGyYhqW9qYDUDSkKt5oRN YQCYhlEnAASIvHAOdyVosYpTbOurSV1HQBqutMIIT8xcUeHsDpDbFgSgkPmDKyEowk7Z MHzhaxfgncE+gl+q2vNPxHJ85EMg7jH1B4sMNio5pMZdltjvYA5rA6lisIzKIG211tsA dcFHft6ighHEI7hkh0KiopZXvy6jBQ0E7OBoBsXJVAsxClj//MAFE2XRRdRIR1KblW5A 7t3g== 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=fhWhQGM8trRZW3D77iWGZYRbSuH2UmFhGnmDA9EZbuA=; b=NMDG+03HZeZJRo4v7eeciHZjlTcSYKsI7JX99b0lXq/k4PqXhnrCYGAJXrP325yhEY HOn+5ywoBFOgUOfa+lQ246xNm878WD/1a+g/TITG+ro3ChxJf6KPrOjyt7BjUS4Tty2X /QIbPBfDzoT6ArKTaL+uz0pZEzE2Bob/lcMrvZz9k+/I8tqtoYdaeHUwnPAAZxdTdhJg bUNnqnl3klbK4GI74vLkqztVTVzku7k+lbGxvd42ekKD/OGYDac6vXGsnHhHMFbMC77N tbbMu8K/Bj1KD3UGM4v9Pr7pZms1YcJld0lKcDZ9SQpTluuSQ5ptZH+AsSko9kurw8E0 KrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FggwccN5; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si3273857edt.103.2020.10.09.22.38.58; Fri, 09 Oct 2020 22:39:22 -0700 (PDT) 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=@kernel.org header.s=default header.b=FggwccN5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390037AbgJIWGg (ORCPT + 99 others); Fri, 9 Oct 2020 18:06:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:59996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389431AbgJIWGg (ORCPT ); Fri, 9 Oct 2020 18:06:36 -0400 Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3638622258; Fri, 9 Oct 2020 22:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602281195; bh=BSdsYnSsWQ2YK6s+0hwikbexRRTi6RzXd6Oify0LIKU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FggwccN5I5AZiuE+Vm843foxykXLgY3+2Ve5JGwMxqNB3E+xShPYydixbERiidVVi QW9J0tz5mlsoo600M7a+WgeVErDk1b1VMW5mDMvhyrS14K46mLfNtrpVvaVMMeP9LF 2DCRbted8w1IYRD5exRfS6+MpJtndCuG5tnmVNDU= Date: Fri, 9 Oct 2020 15:06:33 -0700 From: Eric Biggers To: Linus Torvalds Cc: Al Viro , Christoph Hellwig , Michael Ellerman , the arch/x86 maintainers , Alexey Dobriyan , Luis Chamberlain , Kees Cook , Linux Kernel Mailing List , linux-fsdevel , linux-arch , linuxppc-dev Subject: Re: [PATCH 05/14] fs: don't allow kernel reads and writes without iter ops Message-ID: <20201009220633.GA1122@sol.localdomain> References: <20200903142242.925828-1-hch@lst.de> <20200903142242.925828-6-hch@lst.de> <20201001223852.GA855@sol.localdomain> <20201001224051.GI3421308@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 02, 2020 at 09:27:09AM -0700, Linus Torvalds wrote: > On Thu, Oct 1, 2020 at 3:41 PM Al Viro wrote: > > > > Better > > loff_t dummy = 0; > > ... > > wr = __kernel_write(file, data, bytes, &dummy); > > No, just fix __kernel_write() to work correctly. > > The fact is, NULL _is_ the right pointer for ppos these days. > > That commit by Christoph is buggy: it replaces new_sync_write() with a > buggy open-coded version. > > Notice how new_sync_write does > > kiocb.ki_pos = (ppos ? *ppos : 0); > ,,, > if (ret > 0 && ppos) > *ppos = kiocb.ki_pos; > > but the open-coded version doesn't. > > So just fix that in linux-next. The *last* thing we want is to have > different semantics for the "same" kernel functions. It's a bit unintuitive that ppos=NULL means "use pos 0", not "use file->f_pos". Anyway, it works. The important thing is, this is still broken in linux-next... - Eric