Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1863109imm; Thu, 12 Jul 2018 09:01:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdQvBY6aG1oCxR4UiY1zcuwkScOSZwXzCmXEvEZ4o0jje0S6q+h7cQRkrcB2gTmzUOJL7Nz X-Received: by 2002:a65:55c6:: with SMTP id k6-v6mr2648566pgs.6.1531411306177; Thu, 12 Jul 2018 09:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531411306; cv=none; d=google.com; s=arc-20160816; b=is4+wM1BnJumDCfHjQBW0PFnWmSUC2jhGNooimYxBt5MADd5sYVJHAe974+21+te8q eEMSOo84OhdVJNDfbGeBYGc5ccME+mdG1Jv5UEufn15UqTaWHAMnPQLkg1FMBG6ndfHR H8eqbzbg23nX2NMFNvIr8JHd+EbPUtCoB+zeatEvIMkUHaW05CUWXIKSlmHwanIC3K1U Z4nOVPZT3WJ0BG8kMPXTS+okoN+zuADPUVfa8Fn6KLZB1xRy8i7BqPdt/a0IPJBZF0Bo k/ddVgZave0p1oELbBs228BztUhehkXSg96kDoaGXs69mFGZgTJ8bJJLPF1sFnewtwTo 5vdA== 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:arc-authentication-results; bh=B/y0xIG8tkDKBUVfhH0vsZLGp+/kPTVLx3hFuR91u6c=; b=vq6kGZU/gM9W/mgrFEjs7Yi9ILYZiak3Ufr+xUOC5oYhYta2AJM4fiBMGP6taRinh9 4AO+y/888sk/CAWJNiDkUfiZivj78P2vg0E+7EraWx+xjKv5+EHTa3r97l/3sR+9iWav 1bn9KZZvTQgJWE2vMs2xixzaF4igNyEOwC3q1he9JrpAUKB8IqqY5JLaNuzxQK/go1o2 6PZSrMPgQf7WhCC8qqQq9oyfyzcvdUGkbXGqYcrEo8Yl3wi0deFHEi4tM88/eIEPA4RG xaXUztwLEJGyjBBl9fIG4ZYjw8VraZIwsI6UDr9meu4vxQPOVdAcWBj6mUHiLgV5CdXe zZ/w== 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 y11-v6si21470698plg.301.2018.07.12.09.01.31; Thu, 12 Jul 2018 09:01:46 -0700 (PDT) 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 S1732399AbeGLQKo (ORCPT + 99 others); Thu, 12 Jul 2018 12:10:44 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:39428 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbeGLQKo (ORCPT ); Thu, 12 Jul 2018 12:10:44 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fde19-0000p8-26; Thu, 12 Jul 2018 16:00:31 +0000 Date: Thu, 12 Jul 2018 17:00:31 +0100 From: Al Viro To: Linus Torvalds Cc: David Howells , Andrew Lutomirski , Linux API , linux-fsdevel , Linux Kernel Mailing List , Jann Horn Subject: Re: [PATCH 24/32] vfs: syscall: Add fsopen() to prepare for superblock creation [ver #9] Message-ID: <20180712160030.GV30522@ZenIV.linux.org.uk> References: <153126248868.14533.9751473662727327569.stgit@warthog.procyon.org.uk> <153126264966.14533.3388004240803696769.stgit@warthog.procyon.org.uk> <686E805C-81F3-43D0-A096-50C644C57EE3@amacapital.net> <22370.1531293761@warthog.procyon.org.uk> <7002.1531407244@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 08:50:46AM -0700, Linus Torvalds wrote: > But "write()" simply is *NOT* a good "command" interface. If you want > to send a command, use an ioctl or a system call. > > Because it's not just about credentials. It's not just about fooling a > suid app into writing an error message to a descriptor you wrote. It's > also about things like "splice()", which can write to your target > using a kernel buffer, and thus trick you into doing a command while > we have the context set to kernel addresses. Wait a sec - that's only a problem if your command contains pointer-chasing et.al. Which is why e.g. /dev/sg is fucked in head. But for something that is plain text, what's the problem with splice/write/sendmsg/whatever? I'm not talking about this particular interface, but "write is bad for commands" as general policy looks missing the point. If anything, it's pointer-chasing crap that should be banned everywhere. Just look at SG_IO - it's a ioctl, and it's absolute garbage...