Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3218668pxk; Mon, 28 Sep 2020 11:18:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx/q8Vo4acO3RSzwF9lz2tyxsb7dHI03Zwu8W9wDdymh6rKagqcNSrYaEZJHGX75uqca3K X-Received: by 2002:a50:cf0b:: with SMTP id c11mr3119638edk.87.1601317139602; Mon, 28 Sep 2020 11:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601317139; cv=none; d=google.com; s=arc-20160816; b=tEkQTy6EXrIgJQmt49Q931WK9u3tQMyCdLLK9EIjRdAhH8fURigiTiVLxom3MrQx+Q eJwGPEJ/kKeoZoQF/Argw7hXgXM0JEsKSsLgXBlyw1kZ5AQsByu383xp6/ozvqxHLZeC sL/CyJMYhC5i01J8MhObtUsgBOqSQyUPv/cXdnuxQ6kvcNKQYKysL4OeLk2uC07H9R+J bLLSniOwDJPJFs/2TiqFW60jOaUi1dntHy7WtLGyNBvQ0foEq6SsPk+ALDQ8e0jadliu xcgADOoXXpzWd2MQWN3CzmCjucWxrTzSIcohZlH1MW94syZhx7STcQNt7OvnTJkcVfGi U1qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sr1BVakMmXHw0hhEmRVMJBLy9Fvs40IbMrOWrp3dAdE=; b=0E8PEw9efpOr3Zsgq15ZvU/3zf9B6x7ECWmRciU3ftsf06qRJfCf1T1XDhO1bJTBSW BKcAxA2+QJABpSE30QoKkarqyMCx7EWvw8A26P+EnvlSSxwlLK26FfKl+zcJuXzymKs0 IEzVWSGHcICN4PwgDR/gU5Bpg2eJyB4qkSdRwoeQhbuiuefLjyancjn6bxGd626sBWIZ tpw6JEyxcEcLaWMDIxYR8Ia8ZYjEPRSt4GHStqQAta14qiQfjXv8fosB0s3uG8Gp7d0q cVwsf2TYZmqvavS5r5z1mmjMGRJWKznEcR8HOSYFGAuHbeq3EG7dBqzYSzmt1Eb0LqJy PEKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si1058332ejn.250.2020.09.28.11.18.36; Mon, 28 Sep 2020 11:18:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbgI1SRj (ORCPT + 99 others); Mon, 28 Sep 2020 14:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgI1SRi (ORCPT ); Mon, 28 Sep 2020 14:17:38 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 986CDC061755; Mon, 28 Sep 2020 11:17:38 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMxiP-0088R7-38; Mon, 28 Sep 2020 18:17:33 +0000 Date: Mon, 28 Sep 2020 19:17:33 +0100 From: Al Viro To: Dmitry Kasatkin Cc: David Laight , "linux-fsdevel@vger.kernel.org" , linux-security-module , "linux-kernel@vger.kernel.org" Subject: Re: Mount options may be silently discarded Message-ID: <20200928181733.GC3421308@ZenIV.linux.org.uk> References: <87bb66c2a7f94bd1ab768a8160e48e39@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 09:00:54PM +0300, Dmitry Kasatkin wrote: > But why "we" should allow "discarding" failed part instead of failing > with EFAULT as a whole? Because there might very well be absolutely legitimate users of mount(2) passing it something smaller than 4Kb immediately followed by an unmapped area. What can mount(2) do? It can't go up to the first \0 and stop there, thanks to filesystems (NFS) that want to get struct some_shite filled by userland. It can't require the entire 4Kb from the pointer passed to mount(2) to be mapped and readable, simply because passing it a string literal for e.g. ext4 mount can violate that requirement, not to mention the result of strdup(3)/asprintf(3)/etc. And it can't even tell which semantics to use by looking at the filesystem type - NFS allows both the string and binary structure for options.