Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4696514rwb; Tue, 20 Sep 2022 18:56:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xt/jkE+RI8hc6BoW+cVkICdfmjPhuEh6ykNg1f0luK9ILmu1HtEYrJRQOzZMGCWkvNZBj X-Received: by 2002:a17:906:6a14:b0:774:a998:d9a2 with SMTP id qw20-20020a1709066a1400b00774a998d9a2mr18580717ejc.496.1663725401869; Tue, 20 Sep 2022 18:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663725401; cv=none; d=google.com; s=arc-20160816; b=POu/nCxUvK81+CM/+OLNqnYrN9FMDQmXnhmDQ8b2pBwNqMpNOFFoSgABHu8yq4/wbI eAnO1oMr+S7tlGJL6nBl6EfoPKLNhpSJaGk+iFEsO2eRDFE09rQBkNASjC94FUYQVEtF EzU3kskAPttxxD/Lmy7+9oVz/WIMxyv0tB0pomXkQZolcFlkwSqsMgKV2ngbwVw8jLIV javfQYqLKrd/gD4tV6zrJJOUyj1tvoK/qN1Bya00dnsMZCkCNPYPX71QXlzSseKQzfrH DStchGUPBeVKt1k5PlSH87OPEcwMBHUwVY387lA8BwvkWFO/GvwXmPvHWBkHEE4WayXr XWFQ== 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=NrGo1J/yaUQZV0M6HG36XVcFnHjaPNu8ns6pV8ouas8=; b=M8epGkKVPX6Vsm/3kIs79IqfEFT0rN9hVPNVRuRbIabZggI788X5wHrcn7CC4Th/BG h4G+D5fXlfkAtCWtBQoXBwfx0x3o1x2pFztv702IwkswebBW4k0k7ui1KoD/e+5opNX7 kERObUeaRy956gNZZ2vr6uG4E3RVbEvGJccYN1FVtelKgaRVMG+HYv/jz7jpcFZw5CdN RiHBIwwzqB+SSVPhlR+C0tkRoP52qz0tKTf/+BceLJvR7WyPNulO5chx/qhaewBaIlCz wVtiqqgP0cMDRLOn+w7VCXVBihJhA7siSLTbHr6c8v2CM5UiLXGbqihjsOtEF11DaXAt QI+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=HpAMjrjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a05640235ca00b0044ee88a08b1si1431925edc.277.2022.09.20.18.56.16; Tue, 20 Sep 2022 18:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=HpAMjrjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbiIUBVM (ORCPT + 99 others); Tue, 20 Sep 2022 21:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiIUBVK (ORCPT ); Tue, 20 Sep 2022 21:21:10 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D644C6557B; Tue, 20 Sep 2022 18:21:08 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-120-46.bstnma.fios.verizon.net [173.48.120.46]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 28L1KuLH028389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 21:20:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1663723259; bh=NrGo1J/yaUQZV0M6HG36XVcFnHjaPNu8ns6pV8ouas8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HpAMjrjgMZhY28HgKz3urMhG4/AK9qRJBWqcYWhn8zRGlO7h3YWSYyZgZqFt7Aku8 Dze7spACka9BbtL84rUycuF0dfyoqkbJDBWLF+jMnoMqqMiPHuiKELiR1koFLrpMFe ZBM9JrsuIgsHQjqkbGVaxKCUWtbzNOm43L+lor1e2myfVCmIJ5MpfqBYTWAz3trEs6 fcrMj3GsaS2pvOfjNx8tRvoKDI7D1DNa1igTL6Z2h5yRXDmm4F7sMKKbP/pD8eF/uy XPZ8gNL16fMFi9k5PMr7fLp0L7a+J4nc8uDkOTAKt7OH4HE39ViZc2Sfx7hso7vByc p6RvdH0tpqgig== Received: by cwcc.thunk.org (Postfix, from userid 15806) id CA62715C526C; Tue, 20 Sep 2022 21:20:56 -0400 (EDT) Date: Tue, 20 Sep 2022 21:20:56 -0400 From: "Theodore Ts'o" To: Ian Kent Cc: Al Viro , Andrew Morton , Siddhesh Poyarekar , David Howells , Miklos Szeredi , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Subject: Re: [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem Message-ID: References: <166365872189.39016.10771273319597352356.stgit@donald.themaw.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <166365872189.39016.10771273319597352356.stgit@donald.themaw.net> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 20, 2022 at 03:26:17PM +0800, Ian Kent wrote: > Whenever a mount has an empty "source" (aka mnt_fsname), the glibc > function getmntent incorrectly parses its input, resulting in reporting > incorrect data to the caller. > > The problem is that the get_mnt_entry() function in glibc's > misc/mntent_r.c assumes that leading whitespace on a line can always > be discarded because it will always be followed by a # for the case > of a comment or a non-whitespace character that's part of the value > of the first field. However, this assumption is violated when the > value of the first field is an empty string. > > This is fixed in the mount API code by simply checking for a pointer > that contains a NULL and treating it as a NULL pointer. Why not simply have the mount API code disallow a zero-length "source" / mnt_fsname? - Ted