Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3009810pxu; Sat, 10 Oct 2020 15:57:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz99xblpCkP9WHSjW01TWI+zp8t/25Y8Pup/jv+qVPwTd0/fDN9NYrWQfJuKNweA7OO5UIo X-Received: by 2002:a17:906:22d8:: with SMTP id q24mr20533341eja.479.1602370671702; Sat, 10 Oct 2020 15:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602370671; cv=none; d=google.com; s=arc-20160816; b=UpEIt49F4mooEnIilhutTdb3cOpR7iLz7krCnCa5/LvFbcARndFgeeZO9NGEiH0eTQ q1/5o4gJ5dfdfmH8uo+L9A9ZzIjiLaoLZyiuWZvVb+AR3t4b3Ut80812aENXJ3tyLZ+e L1yjeXEY8Xbd5fwWUMZMq99a+O7b0JHiSCPhxDUV8U4ROcWJTSGhLBDA99H6221ej1C8 GXjCUrFCeBx5yeUGnJkWuEim/uebbXc2I1TqRa0J8NM1221Wr55n0KXCmZUomNgp4dHo SBf4xUUw/MOiVgx+1Wvflw/kNgt+ZnUAtodU//3FfZRZYjdxpR3jAgN/cqD0lTTQovvL S3cw== 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; bh=ZEq+9RUNCLcUowlY3rNV2I+fdNX5VdqF7iThjTKHAYU=; b=BTIPCmOWtrcKPhnJEpRg3E1HCzLxERs8GGnzkZToPL4g7y6W3RNB5WU1PKnqGiIZJK zVEEP9QVj2BTKZ5jfaMXhG6uswQhykgijvsAo7LNSRzz0sK/eQroEz1diBbZNGOWChLz YNxhb3GQTrz1FBRmVwgF+3eVSfsercYL2Aajlo3LIMsUkQd8UhwfyfjqkjWMN6Xihks7 hJZMLnnd0Sj+DA6XR4Z355j+cZfWgXxK+ZN1ZSWk5V6pzsTd5pCS7OsLoUsOF3ei+HZX MF/t9l3SjzsSaXIeHwExs+R/kz85/V/4SxVBX2QVNMSWfm74qO9N0HuKJRaGns29IXKc MoDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zsjr9QjS; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si8977324eja.225.2020.10.10.15.57.28; Sat, 10 Oct 2020 15:57:51 -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=@redhat.com header.s=mimecast20190719 header.b=Zsjr9QjS; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730082AbgJJCIJ (ORCPT + 99 others); Fri, 9 Oct 2020 22:08:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36869 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730030AbgJJBzh (ORCPT ); Fri, 9 Oct 2020 21:55:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602294931; h=from:from:reply-to:subject:subject: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=ZEq+9RUNCLcUowlY3rNV2I+fdNX5VdqF7iThjTKHAYU=; b=Zsjr9QjSBcUNNd4xyMv3oCnmSdfItWDhAMRt+KF2IX+ynuZS0ifDJQIVc+ZaTRu04e010n wf59G1JjISYuLbp+QQD59WYIb/li4NhgrMcUoPbFzx/i6q3yEyeUTVL/4S6i1U3C8MfNvo PJ5R656jxEmWLQ/GEMf2Zu+JjjKyOLo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-66-iD51xsXWOkmoDtx0CE8sLQ-1; Fri, 09 Oct 2020 21:55:27 -0400 X-MC-Unique: iD51xsXWOkmoDtx0CE8sLQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9583C1005513; Sat, 10 Oct 2020 01:55:25 +0000 (UTC) Received: from shell-el7.hosts.prod.upshift.rdu2.redhat.com (shell-el7.hosts.prod.upshift.rdu2.redhat.com [10.0.15.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id F36285D9FC; Sat, 10 Oct 2020 01:55:24 +0000 (UTC) Received: by shell-el7.hosts.prod.upshift.rdu2.redhat.com (Postfix, from userid 2518) id 888946000432; Sat, 10 Oct 2020 01:55:24 +0000 (UTC) Date: Sat, 10 Oct 2020 01:55:24 +0000 From: Alexander Viro To: Linus Torvalds Cc: Eric Biggers , Alexander Viro , 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: <20201010015524.GB101464@shell-el7.hosts.prod.upshift.rdu2.redhat.com> References: <20200903142242.925828-1-hch@lst.de> <20200903142242.925828-6-hch@lst.de> <20201001223852.GA855@sol.localdomain> <20201001224051.GI3421308@ZenIV.linux.org.uk> <20201009220633.GA1122@sol.localdomain> <20201010011919.GC1122@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 09, 2020 at 06:29:13PM -0700, Linus Torvalds wrote: > On Fri, Oct 9, 2020 at 6:19 PM Eric Biggers wrote: > > > > Okay, that makes more sense. So the patchset from Matthew > > https://lkml.kernel.org/linux-fsdevel/20201003025534.21045-1-willy@infradead.org/T/#u > > isn't what you had in mind. > > No. > > That first patch makes sense - it's just the "ppos can be NULL" patch. > > But as mentioned, NULL isn't "shorthand for zero". It's just "pipes > don't _have_ a pos, trying to pass in some explicit position is > crazy". > > So no, the other patches in that set are a bit odd, I think. > > SOME of them look potentially fine - the bpfilter one seems to be > valid, for example, because it's literally about reading/writing a > pipe. And maybe the sysctl one is similarly sensible - I didn't check > the context of that one. FWIW, I hadn't pushed that branch out (or merged it into #for-next yet); for one thing, uml part (mconsole) is simply broken, for another... IMO ##5--8 are asking for kernel_pread() and if you look at binfmt_elf.c, you'll see elf_read() being pretty much that. acct.c, keys and usermode parts are asking for kernel_pwrite() as well. I've got stuck looking through the drivers/target stuff - it would've been another kernel_pwrite() candidate, but it smells like its use of filp_open() is really asking for trouble, starting with symlink attacks. Not sure - I'm not familiar with the area, but...