Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11032879rwd; Thu, 22 Jun 2023 07:59:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6XQunUCbDqo8t6ur4btOsLoOdBvocd7L4L4Qhs7+7+F7rSAKqQtpz4gahLKEP1/U1tmsLt X-Received: by 2002:a05:6a20:244a:b0:115:1784:6a1f with SMTP id t10-20020a056a20244a00b0011517846a1fmr34440742pzc.19.1687445949768; Thu, 22 Jun 2023 07:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687445949; cv=none; d=google.com; s=arc-20160816; b=0QdJwgJ7WV9G4amOXkLsImALNapV3CyFDWB+6mKtQlIqNuBmm7rQeNNLSiSMxPHRju fwieAmlmDD1gOOGXWSlvivbIVqzzGmVpn82jW1vf9lDP8PK2BLIkjalXk2Zhetca/anM 0FaVrrygjxNKUfFzGJa+DFMAbI9qa810Hpms19bkpzy+ARta1P6jFSUKIbe2ZFoLg1GD 4dDkKklRHzHKhC4XhMPE8Gn2aSD1IMR7UMoyn4Rys9WkTkJRZQ1NzIZ3Rb+mRQw4qVJ+ k0/8UZ+kDG6JaUPvTuda2sItZgp345ouuc6mP4hhHFg6tHBg7Fhhdj+3K6aZOXKCJZp6 k1lA== 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; bh=tkM5WdGcrqCi28ZGtJUWKR+QSo6V+lkdqeaoOlZ5pFs=; b=eZXWwuJvZNq0iq7s5E9JDo7LH72+oUPjsMS7UX5ghoytfMqite7+vmZfrd62+ptMXn R5riMYY7GNhjqEFp2/t0tKLCNNeHnJe8R8vAtxw+6Cl71+a/Emu+YziIWniAN5nrAUzA DYTqU163+YdBfFRP+srP5/HOpWyv+vIAi+FHOHHFz5SP/1fyWsuYBmjDcR8S6BIALG+U ozN2lB8oHb0pqcGfBzF+bDl0VBSHhKU0lEOx/4g/DyGwgDZ4Srz3tDDHAdrAK9BSQHdS lX95q/Q3wEaNR2juJYBp5YKaTP/rOwbJlzdsP6lljSsBoDJ3nHKkiR+1zgXRYpF+6b9C KIbA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a6540cb000000b005573b42d9e3si2901657pgp.593.2023.06.22.07.58.57; Thu, 22 Jun 2023 07:59:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbjFVOk4 (ORCPT + 99 others); Thu, 22 Jun 2023 10:40:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbjFVOkz (ORCPT ); Thu, 22 Jun 2023 10:40:55 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839511FDD; Thu, 22 Jun 2023 07:40:46 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 4992C67373; Thu, 22 Jun 2023 16:40:42 +0200 (CEST) Date: Thu, 22 Jun 2023 16:40:42 +0200 From: Christoph Hellwig To: Guenter Roeck Cc: Christoph Hellwig , Jens Axboe , Greg Kroah-Hartman , "Rafael J. Wysocki" , Mike Snitzer , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 14/24] init: clear root_wait on all invalid root= strings Message-ID: <20230622144042.GA21415@lst.de> References: <20230523074535.249802-1-hch@lst.de> <20230523074535.249802-15-hch@lst.de> <8c1992bc-110a-4dad-8643-766c14bf6fd4@roeck-us.net> <20230622035149.GA4667@lst.de> <2205ef1e-9bb6-fb1e-9ca3-367c1afe12ac@roeck-us.net> <20230622060001.GA8351@lst.de> <8e6c8365-5c2b-2bad-bf3c-df2d65cc8afa@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e6c8365-5c2b-2bad-bf3c-df2d65cc8afa@roeck-us.net> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, Jun 22, 2023 at 06:54:41AM -0700, Guenter Roeck wrote: > On 6/21/23 23:00, Christoph Hellwig wrote: >> Hi Guenter, >> >> can you try this patch? >> >> diff --git a/block/early-lookup.c b/block/early-lookup.c >> index a5be3c68ed079c..66e4514d671179 100644 >> --- a/block/early-lookup.c >> +++ b/block/early-lookup.c >> @@ -174,7 +174,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt) >> while (p > s && isdigit(p[-1])) >> p--; >> if (p == s || !*p || *p == '0') >> - return -EINVAL; >> + return -ENODEV; >> /* try disk name without */ >> part = simple_strtoul(p, NULL, 10); > > Not completely. Tests with root=/dev/sda still fail. > > "name" passed to devt_from_devname() is "sda". > > for (p = s; *p; p++) { > if (*p == '/') > *p = '!'; > } > > advances 'p' to the end of the string. > > while (p > s && isdigit(p[-1])) > p--; > > moves it back to point to the first digit (if there is one). > > if (p == s || !*p || *p == '0') > return -EINVAL; > > then fails because *p is 0. In other words, the function only accepts > drive names with digits at the end (and the first digit must not be '0'). > > I don't recall how I hit the other condition earlier. I have various > "/dev/mmcblkX" in my tests, where X can be any number including 0. > Maybe those fail randomly as well. > > Overall I am not sure though what an "invalid" devicename is supposed > to be in this context. I have "sda", "sr0", "vda", "mtdblkX", > "nvme0n1", "mmcblkX", and "hda". Why would any of those not be eligible > for "rootwait" ? > > In practice, everything not ending with a digit, or ending with > '0', fails the first test. Everything ending with a digit > 0 > fails the second test. But "humptydump3p4" passes all those tests. Yeah. I guess I should give up on the idea of error out in this particular parser. The idea sounded good, but I guess it doesn't work. So we'll probably want his fix: diff --git a/block/early-lookup.c b/block/early-lookup.c index a5be3c68ed079c..9e2d5a19de1b3b 100644 --- a/block/early-lookup.c +++ b/block/early-lookup.c @@ -174,7 +174,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt) while (p > s && isdigit(p[-1])) p--; if (p == s || !*p || *p == '0') - return -EINVAL; + return -ENODEV; /* try disk name without */ part = simple_strtoul(p, NULL, 10); @@ -185,7 +185,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt) /* try disk name without p */ if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p') - return -EINVAL; + return -ENODEV; p[-1] = '\0'; *devt = blk_lookup_devt(s, part); if (*devt)