From patchwork Tue Jun 15 21:21:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1492506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fJ+YyLe9; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=SJfhMTgB; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4Nnv1HKtz9sRf for ; Wed, 16 Jun 2021 08:50:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5aQ20/H/4CZ5M8+//0snVpOobyHTN7q7+C0TcmaFIxg=; b=fJ+YyLe918RAyn cQabLfrwl/rrG+Yllt/6Zl0r84SmN6/YPgGKuN/H51S+WAWdX4xMgA2rBimXIsP82n8R5GGU85WTz I7/Ia38T7JetbtcCteSvHyf46GlMFF2J6bUQ5OVmHfxIzmplxQ7WWfHeHz6rI1UUaFDBkYqc2cbNb xeUI4o/c/Mq4V6iiPgIMtjiY1oZeZMFSZHdZolFgMjxO5MbNPqMdQWfJnFvWwZ5o/piqkj3XjyZGB 7Aesx3NZOPcVA99k3y6k3SDuqQ7vaF4BoaP5jQMy09cEAhMdoWo0ct3CrE5aYMjwCEhYCnvYyUb2j deEhpolo+2Eg7N1Bx8zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltHsc-003hDe-P1; Tue, 15 Jun 2021 22:49:59 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltGUx-0036jU-Ob for linux-mtd@lists.infradead.org; Tue, 15 Jun 2021 21:21:29 +0000 Received: by mail-pl1-x632.google.com with SMTP id h1so27498plt.1 for ; Tue, 15 Jun 2021 14:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=83yPG0EbFVr3SVh9NOBRiR0LGkMMFjPnxGPwEf0h9WU=; b=SJfhMTgBKkNck0DLHiyFQAMGBQiYJl9bmikbn+3Lp/t4d1oeBHwObQNlzZ0dOjAe0+ RC5UWlZgE81S6saO0a2ztgFpvOJz1wFIl8BtV5rtghxD6cl081EJbKw9nJ6EEfQQt/o6 DWerWeabH6YkpA3e0shmR+s/i9A8w39jLF7Cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=83yPG0EbFVr3SVh9NOBRiR0LGkMMFjPnxGPwEf0h9WU=; b=Vrxm0IDXisa6vUyXYgyKVVgKBzmr/0jkK8aDAngpX9/x0VOlBVtlZUDxYhbkoOIG/j dlnq3tZZ3Spe76DpbLiYIVSzNjZcmrGTFiPn0/tbdsf58A9niAdpl4/nSoizYRT6srie 5RTwKYzab9t1462XPCpPi4ZwOUquczhVDb4baANt0Y7OloqEm3IMC2qJZVI9UpJCiJ/y 2roSKvzVJ293/Otdpn++E8IC5AT03CzYnq4SDvRSzhaWBwPa1JRT8zMmxzZiX9vsGrf5 sMAWBJ9yBd8VItg1tDwQHhLf/dP5geQsxZhFb1+1fx4GfT+j6w5M80VrI7exNqTER5jE QPgg== X-Gm-Message-State: AOAM532MMMefQBFKsuWk7pRSSYufUljyxt40srzLM/lumYdThCoBH9Am j5Rl7YvVKI/yXIq2jP74649wfg== X-Google-Smtp-Source: ABdhPJyOHvKXPd88U7Ng3kUR5Pe6gtsxiOBZKK/gSe0WnsnJvTx8JUA7RX5Hc+uDNGQLtnT3Xgv0Dg== X-Received: by 2002:a17:90a:d483:: with SMTP id s3mr6958605pju.61.1623792086887; Tue, 15 Jun 2021 14:21:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z9sm98105pfa.2.2021.06.15.14.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 14:21:24 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Christoph Hellwig , Al Viro , gmpy.liaowx@gmail.com, Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-doc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v2 1/4] pstore/blk: Improve failure reporting Date: Tue, 15 Jun 2021 14:21:18 -0700 Message-Id: <20210615212121.1200820-2-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615212121.1200820-1-keescook@chromium.org> References: <20210615212121.1200820-1-keescook@chromium.org> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; g=782d384d6486fe89f671933d300cdcc0b58915de; i=x+eth6WIY3ZV3RikljpGvsEDOkHC4+JR/D6VkOL4MwM=; m=KWKLltarrgCHVaChKkiXTTMXR+nWhEDb2yQ+7Fx0dy0=; p=Tg76lnQ+eXJOmzqDWYbfNJALp24lTAKgJm1/vS8S8JE= X-Patch-Sig: m=pgp; i=keescook@chromium.org; s=0x0x8972F4DFDC6DC026; b=iQIzBAABCgAdFiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmDJGdAACgkQiXL039xtwCaQmhAAhER rf9rrrOC5Ufm5tSBzRs8WRgIklq6gyVFRzdiqk/xEzIN7j/qlXR56KeI6dCfskYhf8JGky/FBdnoX 5YRfXX/ANRiZ/pA69pClLA2fYxM37EX7gqxYA6XmwgeIPGO+3w7mlZ9rxstLmg/7msVicK7+aDVsx tv3ufAl9Yp1pECdZ90FaFNWEdTw6+lmHYzmMqGiRfxr8Vg0cClO7kkAy6DObfCXqCsUaCp8tsjCFa P1ieQ+PGW3vNIxZci3zADPFWQz6/t8VkT3gFl9vUqHrtYtwpgBK0hcdlu0tHrPunU1bhkvR9J5aJA i3x5psdyNaV2E2KKXeq78irRPceNdQxbxpxrOpWqJrKa3kxyEHFlZe//HT2QfyXjrVI5uAAl1M5mu D189qXiSeS6UDh/Kr78HbJE9o0S1xAXaA9/mtRHLcZNC28dcTkzoqi4JRQKRGugZynGJyynWTsfUu 4ajxovmObroq2UPfcj56fgIfOavfUmxiWWqfI21SIZ1WbrepKrcsD4YYLfMv9t/8kUpGanhyxTkVg xvVVyCOfA+ReUVgFidq/mFPM8xHPEkXa+zo0weOncXhAyBYO25ugYR6EgHkkukrrak0yoFgyZdkUe +4ZOhtYaDtANnr+eyj8qcSmr8FaC2gcxt+aR/NGq9ekIlbOqfNABgjj6aN93VczE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210615_142127_858242_03D7D972 X-CRM114-Status: GOOD ( 13.87 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: There was no feedback on bad registration attempts. Add details on the failure cause. Signed-off-by: Kees Cook --- fs/pstore/blk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:632 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org There was no feedback on bad registration attempts. Add details on the failure cause. Signed-off-by: Kees Cook --- fs/pstore/blk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c index 4bb8a344957a..91d7a848c85b 100644 --- a/fs/pstore/blk.c +++ b/fs/pstore/blk.c @@ -114,8 +114,19 @@ static int __register_pstore_device(struct pstore_device_info *dev) lockdep_assert_held(&pstore_blk_lock); - if (!dev || !dev->total_size || !dev->read || !dev->write) + if (!dev || !dev->total_size || !dev->read || !dev->write) { + if (!dev) + pr_err("NULL device info\n"); + else { + if (!dev->total_size) + pr_err("zero sized device\n"); + if (!dev->read) + pr_err("no read handler for device\n"); + if (!dev->write) + pr_err("no write handler for device\n"); + } return -EINVAL; + } /* someone already registered before */ if (pstore_zone_info) From patchwork Tue Jun 15 21:21:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1492505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Kolqu/hU; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JsVqLuvG; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4NmS3C5Yz9sRf for ; Wed, 16 Jun 2021 08:49:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vP9V0hOlwBSJnNFviWdY0Kw5d/BfEcPgBIxDtxeNHH4=; b=Kolqu/hUJJNKdY LI0U2Wq+mkoSMm3N2W8o1V0IwvE/kcjcERVncdw1k4pery5j7iCnBV22qhYhyeGY6G3+q17C+runW oEc6p7IWsavP2KTTRu+a3tdnurcQ6HF1ozMxLFDIDSxg4Tk8BIlXZG5cajc5QP8CSpDdRWpDP7IUF 33i4IdYs/cqHKCrQg6PnGRWmxMltfcgtz1O9k2h2PoxI1GFUY5FDrpXjeeAsQur0ipBBQZo5LxeMw Lj8T6nKHANEXX609TvECZEKFp3kMvskDjqXsZGHxJmmBQQ9KsV0jlpg9K5mdQ1oqcTe7TVHoeppwI Gu9YJThgeIcXX84slCcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltHrR-003gvd-GG; Tue, 15 Jun 2021 22:48:45 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltGUv-0036hl-S0 for linux-mtd@lists.infradead.org; Tue, 15 Jun 2021 21:21:28 +0000 Received: by mail-pg1-x52c.google.com with SMTP id v7so165892pgl.2 for ; Tue, 15 Jun 2021 14:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VgP/ujDj3JOk9fd8Bd57+T3WUDHouG7B5z46L4i6NYk=; b=JsVqLuvGYu2mYwxAtS146TEaTAE+aXtV/flGvHdgjCdhwD/TGJXes14dzW77cFf9IO 4TzkvbFKZLRybxL5z2TxRDe4kKwYbiF8d74LVJta40kjKWyHWw7xjYh+eJF1PMVlLJ8Y m+FTJAJNmm5SjpdZ4gS8AN2vgtpAERBAnU9S8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VgP/ujDj3JOk9fd8Bd57+T3WUDHouG7B5z46L4i6NYk=; b=RirVY+AXIDZrCfla/wKgqQKND+62spDq2C3bkhBtT7t19+pWS03+q/UgrNCrr2azHw XPXujbFUPjC/ROoF2AYIio9csWSbmNTIwxm+M6plUflHXkRBpqdBIZ0ETMyFpeX1LN2n RyPlmtKUgIoOWywSO1faukJlWS1VvSn/8PrVsyV7jeJU+dpyHtTMS4VMANre3Be8/vL5 fCWcD25P7bjObHfl0WRLmuxP2URfo1q3BpQt21p74Y8vsrrnf/r17blClmynsjKLLSTV hu8m0UaTQg9xFepqQK0YXfywsBiOtTiHQrT790F9xbKPSQxicFd/Rskx5HImxk54Z6Wa Wrfg== X-Gm-Message-State: AOAM532sy9SxWZYZh+B7F3K6dgC3yNbTbCDI3nKwmJGXB4odoj66SHY6 sJMOpWR/glJhmtRt3S/l2aLXWg== X-Google-Smtp-Source: ABdhPJzfR0w4R6t/DNCrToE0zmEQPHUj7ZB04C22NS6NT9qyFsk1r2gCMRAOcClCy+TIfI3xzK2nEA== X-Received: by 2002:a63:1c0a:: with SMTP id c10mr1480858pgc.306.1623792084311; Tue, 15 Jun 2021 14:21:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d22sm55073pgb.15.2021.06.15.14.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 14:21:23 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Christoph Hellwig , Al Viro , gmpy.liaowx@gmail.com, Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-doc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v2 2/4] pstore/blk: Use the normal block device I/O path Date: Tue, 15 Jun 2021 14:21:19 -0700 Message-Id: <20210615212121.1200820-3-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615212121.1200820-1-keescook@chromium.org> References: <20210615212121.1200820-1-keescook@chromium.org> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; g=ce419b191f409d79c00afbb68a6ff8fff3d7fc44; i=SsOtgEq5qb4nZxhHBpq4SPkuFKirt6TdeGDEanJT//k=; m=AX20vtCwKnCA9lIRJQ6C3o1nYyFB2hBR6BVOnkiJdKA=; p=9gk70/7/z6XITBmbxTi/U6pZ/ZxycvfUbcloTA9Hj8M= X-Patch-Sig: m=pgp; i=keescook@chromium.org; s=0x0x8972F4DFDC6DC026; b=iQIzBAABCgAdFiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmDJGdAACgkQiXL039xtwCamshAAmSQ 3hCEjnYiThOdJjPw57ZAOy8kw7cbbIk/lFC3Pmin2uDJNeIRc7HmBYGgpVliiq/Aw3yFOzLnRjVSX QHKduRGvoYPAUufJIvD2Q2+d5qxOkqwMaFATQKBUjgX661dO7Y/FZoYkpwKspPowP/mt3UJGmJbJL Ns8c20TwggjKt3aWUzD3riNWArIsz/ohIfY4uRGoB11aE5BW4l6MRPe1uCYum2jcykD3+C9L/lJ5A IEHOj9v0G/xJ7mDhgt1hUPdYnBidwbHVnxUailTuyc3kbu47rueUEnp2tp1p/yDCsmmg2arU2CU2/ XRK9u1BkdVhB90GDcYqFrhNXPBRZvMka2MOZu0U7r/LgW1o01Eko0bP7x2pznyW40T7yRmi6qjbvA Z9PTzzw0CiFWgDj+AtjQps7leVobqYixiNM6ZEI8AsTt4Xppf4FHtv57JRMk9IybqmL4Mqa0hISo7 vQiJNh8SPSaFMmGtCsqgv61ObZ3UD8xcM6wqMJa8wEfso9DurXQRnJT4HKiTjDxzSsEvYS/Urf2yI Ql81uUGbaaA+L01DqzN7POoDBBuS3rIF0TFGJVd8LGHGyMtD/ZgAql+wZG8qq4IRxigjnIfFZxcuc +4UyWKgTbEzw7Y339DNldPIjvZKI5Wf8+TtZNX0Qkh9XPi93fZLxeEfaD+NikMz4= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210615_142125_994841_4DF5BAB8 X-CRM114-Status: GOOD ( 32.31 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Stop poking into block layer internals and just open the block device file an use kernel_read and kernel_write on it. Note that this means the transformation from name_to_dev_t can't be used anymore w [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:52c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Stop poking into block layer internals and just open the block device file an use kernel_read and kernel_write on it. Note that this means the transformation from name_to_dev_t can't be used anymore when pstore_blk is loaded as a module: a full filesystem device path name must be used instead. Co-developed-by: Christoph Hellwig Signed-off-by: Christoph Hellwig Signed-off-by: Kees Cook Reviewed-by: Christoph Hellwig --- fs/pstore/blk.c | 261 +++++++++++++++--------------------------------- 1 file changed, 80 insertions(+), 181 deletions(-) diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c index 91d7a848c85b..8f5bd656cc2d 100644 --- a/fs/pstore/blk.c +++ b/fs/pstore/blk.c @@ -8,15 +8,16 @@ #include #include -#include "../../block/blk.h" #include #include #include #include #include #include +#include +#include +#include #include -#include static long kmsg_size = CONFIG_PSTORE_BLK_KMSG_SIZE; module_param(kmsg_size, long, 0400); @@ -60,23 +61,25 @@ MODULE_PARM_DESC(best_effort, "use best effort to write (i.e. do not require sto * * Usually, this will be a partition of a block device. * - * blkdev accepts the following variants: - * 1) device number in hexadecimal representation, - * with no leading 0x, for example b302. - * 2) /dev/ represents the device number of disk - * 3) /dev/ represents the device number + * blkdev accepts the following variants, when built as a module: + * 1) /dev/ represents the device number of disk + * 2) /dev/ represents the device number * of partition - device number of disk plus the partition number - * 4) /dev/p - same as the above, that form is + * 3) /dev/p - same as the above, that form is * used when disk name of partitioned disk ends on a digit. - * 5) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the + * + * blkdev accepts the following variants when built into the kernel: + * 1) device number in hexadecimal representation, + * with no leading 0x, for example b302. + * 2) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the * unique id of a partition if the partition table provides it. * The UUID may be either an EFI/GPT UUID, or refer to an MSDOS * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero- * filled hex representation of the 32-bit "NT disk signature", and PP * is a zero-filled hex representation of the 1-based partition number. - * 6) PARTUUID=/PARTNROFF= to select a partition in relation to + * 3) PARTUUID=/PARTNROFF= to select a partition in relation to * a partition with a known unique id. - * 7) : major and minor number of the device separated by + * 4) : major and minor number of the device separated by * a colon. */ static char blkdev[80] = CONFIG_PSTORE_BLK_BLKDEV; @@ -88,15 +91,9 @@ MODULE_PARM_DESC(blkdev, "block device for pstore storage"); * during the register/unregister functions. */ static DEFINE_MUTEX(pstore_blk_lock); -static struct block_device *psblk_bdev; +static struct file *psblk_file; static struct pstore_zone_info *pstore_zone_info; -struct bdev_info { - dev_t devt; - sector_t nr_sects; - sector_t start_sect; -}; - #define check_size(name, alignsize) ({ \ long _##name_ = (name); \ _##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \ @@ -216,203 +213,70 @@ void unregister_pstore_device(struct pstore_device_info *dev) } EXPORT_SYMBOL_GPL(unregister_pstore_device); -/** - * psblk_get_bdev() - open block device - * - * @holder: Exclusive holder identifier - * @info: Information about bdev to fill in - * - * Return: pointer to block device on success and others on error. - * - * On success, the returned block_device has reference count of one. - */ -static struct block_device *psblk_get_bdev(void *holder, - struct bdev_info *info) -{ - struct block_device *bdev = ERR_PTR(-ENODEV); - fmode_t mode = FMODE_READ | FMODE_WRITE; - sector_t nr_sects; - - lockdep_assert_held(&pstore_blk_lock); - - if (pstore_zone_info) - return ERR_PTR(-EBUSY); - - if (!blkdev[0]) - return ERR_PTR(-ENODEV); - - if (holder) - mode |= FMODE_EXCL; - bdev = blkdev_get_by_path(blkdev, mode, holder); - if (IS_ERR(bdev)) { - dev_t devt; - - devt = name_to_dev_t(blkdev); - if (devt == 0) - return ERR_PTR(-ENODEV); - bdev = blkdev_get_by_dev(devt, mode, holder); - if (IS_ERR(bdev)) - return bdev; - } - - nr_sects = bdev_nr_sectors(bdev); - if (!nr_sects) { - pr_err("not enough space for '%s'\n", blkdev); - blkdev_put(bdev, mode); - return ERR_PTR(-ENOSPC); - } - - if (info) { - info->devt = bdev->bd_dev; - info->nr_sects = nr_sects; - info->start_sect = get_start_sect(bdev); - } - - return bdev; -} - -static void psblk_put_bdev(struct block_device *bdev, void *holder) -{ - fmode_t mode = FMODE_READ | FMODE_WRITE; - - lockdep_assert_held(&pstore_blk_lock); - - if (!bdev) - return; - - if (holder) - mode |= FMODE_EXCL; - blkdev_put(bdev, mode); -} - static ssize_t psblk_generic_blk_read(char *buf, size_t bytes, loff_t pos) { - struct block_device *bdev = psblk_bdev; - struct file file; - struct kiocb kiocb; - struct iov_iter iter; - struct kvec iov = {.iov_base = buf, .iov_len = bytes}; - - if (!bdev) - return -ENODEV; - - memset(&file, 0, sizeof(struct file)); - file.f_mapping = bdev->bd_inode->i_mapping; - file.f_flags = O_DSYNC | __O_SYNC | O_NOATIME; - file.f_inode = bdev->bd_inode; - file_ra_state_init(&file.f_ra, file.f_mapping); - - init_sync_kiocb(&kiocb, &file); - kiocb.ki_pos = pos; - iov_iter_kvec(&iter, READ, &iov, 1, bytes); - - return generic_file_read_iter(&kiocb, &iter); + return kernel_read(psblk_file, buf, bytes, &pos); } static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes, loff_t pos) { - struct block_device *bdev = psblk_bdev; - struct iov_iter iter; - struct kiocb kiocb; - struct file file; - ssize_t ret; - struct kvec iov = {.iov_base = (void *)buf, .iov_len = bytes}; - - if (!bdev) - return -ENODEV; - /* Console/Ftrace backend may handle buffer until flush dirty zones */ if (in_interrupt() || irqs_disabled()) return -EBUSY; - - memset(&file, 0, sizeof(struct file)); - file.f_mapping = bdev->bd_inode->i_mapping; - file.f_flags = O_DSYNC | __O_SYNC | O_NOATIME; - file.f_inode = bdev->bd_inode; - - init_sync_kiocb(&kiocb, &file); - kiocb.ki_pos = pos; - iov_iter_kvec(&iter, WRITE, &iov, 1, bytes); - - inode_lock(bdev->bd_inode); - ret = generic_write_checks(&kiocb, &iter); - if (ret > 0) - ret = generic_perform_write(&file, &iter, pos); - inode_unlock(bdev->bd_inode); - - if (likely(ret > 0)) { - const struct file_operations f_op = {.fsync = blkdev_fsync}; - - file.f_op = &f_op; - kiocb.ki_pos += ret; - ret = generic_write_sync(&kiocb, ret); - } - return ret; + return kernel_write(psblk_file, buf, bytes, &pos); } /* * This takes its configuration only from the module parameters now. - * See psblk_get_bdev() and blkdev. */ -static int __register_pstore_blk(void) +static int __register_pstore_blk(const char *devpath) { - char bdev_name[BDEVNAME_SIZE]; - struct block_device *bdev; - struct pstore_device_info dev; - struct bdev_info binfo; - void *holder = blkdev; + struct pstore_device_info dev = { + .read = psblk_generic_blk_read, + .write = psblk_generic_blk_write, + }; int ret = -ENODEV; lockdep_assert_held(&pstore_blk_lock); - /* hold bdev exclusively */ - memset(&binfo, 0, sizeof(binfo)); - bdev = psblk_get_bdev(holder, &binfo); - if (IS_ERR(bdev)) { - pr_err("failed to open '%s'!\n", blkdev); - return PTR_ERR(bdev); + psblk_file = filp_open(devpath, O_RDWR | O_DSYNC | O_NOATIME | O_EXCL, 0); + if (IS_ERR(psblk_file)) { + ret = PTR_ERR(psblk_file); + pr_err("failed to open '%s': %d!\n", devpath, ret); + goto err; } - /* only allow driver matching the @blkdev */ - if (!binfo.devt) { - pr_debug("no major\n"); - ret = -ENODEV; - goto err_put_bdev; + if (!S_ISBLK(file_inode(psblk_file)->i_mode)) { + pr_err("'%s' is not block device!\n", devpath); + goto err_fput; } - /* psblk_bdev must be assigned before register to pstore/blk */ - psblk_bdev = bdev; - - memset(&dev, 0, sizeof(dev)); - dev.total_size = binfo.nr_sects << SECTOR_SHIFT; - dev.read = psblk_generic_blk_read; - dev.write = psblk_generic_blk_write; + dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode); ret = __register_pstore_device(&dev); if (ret) - goto err_put_bdev; + goto err_fput; - bdevname(bdev, bdev_name); - pr_info("attached %s (no dedicated panic_write!)\n", bdev_name); return 0; -err_put_bdev: - psblk_bdev = NULL; - psblk_put_bdev(bdev, holder); +err_fput: + fput(psblk_file); +err: + psblk_file = NULL; + return ret; } -static void __unregister_pstore_blk(unsigned int major) +static void __unregister_pstore_blk(struct file *device) { struct pstore_device_info dev = { .read = psblk_generic_blk_read }; - void *holder = blkdev; lockdep_assert_held(&pstore_blk_lock); - if (psblk_bdev && MAJOR(psblk_bdev->bd_dev) == major) { + if (psblk_file && psblk_file == device) { __unregister_pstore_device(&dev); - psblk_put_bdev(psblk_bdev, holder); - psblk_bdev = NULL; + fput(psblk_file); + psblk_file = NULL; } } @@ -430,13 +294,48 @@ int pstore_blk_get_config(struct pstore_blk_config *info) } EXPORT_SYMBOL_GPL(pstore_blk_get_config); + +#ifndef MODULE +static const char devname[] = "/dev/pstore-blk"; +static __init const char *early_boot_devpath(const char *initial_devname) +{ + /* + * During early boot the real root file system hasn't been + * mounted yet, and no device nodes are present yet. Use the + * same scheme to find the device that we use for mounting + * the root file system. + */ + dev_t dev = name_to_dev_t(initial_devname); + + if (!dev) { + pr_err("failed to resolve '%s'!\n", initial_devname); + return initial_devname; + } + + init_unlink(devname); + init_mknod(devname, S_IFBLK | 0600, new_encode_dev(dev)); + + return devname; +} +#else +static inline const char *early_boot_devpath(const char *initial_devname) +{ + return initial_devname; +} +#endif + static int __init pstore_blk_init(void) { int ret = 0; mutex_lock(&pstore_blk_lock); - if (!pstore_zone_info && best_effort && blkdev[0]) - ret = __register_pstore_blk(); + if (!pstore_zone_info && best_effort && blkdev[0]) { + ret = __register_pstore_blk(early_boot_devpath(blkdev)); + if (ret == 0 && pstore_zone_info) + pr_info("attached %s:%s (%zu) (no dedicated panic_write!)\n", + pstore_zone_info->name, blkdev, + pstore_zone_info->total_size); + } mutex_unlock(&pstore_blk_lock); return ret; @@ -446,8 +345,8 @@ late_initcall(pstore_blk_init); static void __exit pstore_blk_exit(void) { mutex_lock(&pstore_blk_lock); - if (psblk_bdev) - __unregister_pstore_blk(MAJOR(psblk_bdev->bd_dev)); + if (psblk_file) + __unregister_pstore_blk(psblk_file); else { struct pstore_device_info dev = { }; From patchwork Tue Jun 15 21:21:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1492512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=2SdBHCcO; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jfbWOCBe; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4Nsm6FG6z9sTD for ; Wed, 16 Jun 2021 08:54:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kjawmYUetCgB6a3Jh6OiIQErNEH6fuh/ZHjrd9PYW14=; b=2SdBHCcOVZpPu6 0yuMsAL600po7EruLndcw2lLhBkQxf7bh+9v2rkIkqYNmz7mqziVVL2SD+3wOcBDobvmF+eZSF3cC MlzVca4lznYlBNAbszwh6QKn1DDOJZMZFyc+XfBgiYeR2CzGUqe01JIoaIFfNGFLaVHNv/RLIfq8c B1NGM+OYrH3ilMEFc0UY8b5wLxVIAgMlxQudnNQPDvWyr32HDvW6Qtr1g+2W8C5oKsXG8EVFHW9iU ICyERMgD6oFh7JW1s/R88xCNj3iV0xDcDagVzPC36J09v7Sv7iHXzNXxeRRnpcejf2dZyP8R3Fnph 4NIa9TRRBbuVbgx5QS6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltHvv-003i1s-UO; Tue, 15 Jun 2021 22:53:24 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltGUy-0036k4-Qr for linux-mtd@lists.infradead.org; Tue, 15 Jun 2021 21:21:31 +0000 Received: by mail-pf1-x431.google.com with SMTP id g6so482487pfq.1 for ; Tue, 15 Jun 2021 14:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QQuWk5oOmzR3+MBzf1Y5kFtlcef8MqT/01wlIDqw2YU=; b=jfbWOCBe3bM+wLUiepl7fnkaZ7873RB/BpyhovaXZ2WAZQb3+OGqRyDYmeF37wFdHU NiC9boMyt6rH6Rb86kZvnRgNf09xNKUphZp7AkEj2AQqxLUOl/dmINLIyGWxzj8YnMSl Lqppveg+hKw6RjZjHiqVDh1ubHorR9blT/v+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QQuWk5oOmzR3+MBzf1Y5kFtlcef8MqT/01wlIDqw2YU=; b=AM/N9FOhksAgNgwDZ2QS+u6tJNRe0pv4eIL0ED3cn62cPIHzH/Bkyodxtp0Kt6dUAa sjfSo3BjoaHJyPm/jFrk4L1R4tVQDux1YyzK/0mC2LWKAUzYjVl4bcraAO+L507ugPeu P7zO4AEm+cgGH56aevpGWzVGTl8ZMSH1jQAAupICkWfsZHAyYnqdl1OYRQ7T/+gVsqpI Mr1P20AEmDoeK8yjJKHRrBj09n/KAF9C9NoIdeC+POZrl8kfv4fLq9FHGc0/BmfOIfq9 9ygYvPOSpdwxMDroEfDeu3iNM/CBk2k1Ras44BUsXE64JkKlx2zhrNDduUkdlTjIlsHc QWuA== X-Gm-Message-State: AOAM532OXfJtr60rslcRsbmeBOG0HZ1Yi6UqtdcbPKgd6U5dY65UciLA etA+MQ0H1+2q3h6a9+C5BFGAvw== X-Google-Smtp-Source: ABdhPJxv08gD1iooT16I/J+jl8d/hEyuNoj/rHWFbvF7fv81s1D9NiTfgIfzuGLGnJM5scYGinwOZQ== X-Received: by 2002:a62:34c7:0:b029:28e:addf:f17a with SMTP id b190-20020a6234c70000b029028eaddff17amr6603010pfa.62.1623792086251; Tue, 15 Jun 2021 14:21:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n72sm97432pfd.8.2021.06.15.14.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 14:21:24 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Christoph Hellwig , Al Viro , gmpy.liaowx@gmail.com, Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-doc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v2 3/4] pstore/blk: Include zone in pstore_device_info Date: Tue, 15 Jun 2021 14:21:20 -0700 Message-Id: <20210615212121.1200820-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615212121.1200820-1-keescook@chromium.org> References: <20210615212121.1200820-1-keescook@chromium.org> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; g=efcf5526fe13766bd98acae29e0115d24b07d210; i=OzHp+/X5c8B1qT+xdnUXKoWwSY89uY95adXbT6Ztj74=; m=WOqt0d4utZlTaiUKpB0qyaFAJBWPe3VuJCNaOBLEDLw=; p=GZLcj+Pw6pTB7TcSUO0TjvUzZzwmL6Y5LQQOOEKli3E= X-Patch-Sig: m=pgp; i=keescook@chromium.org; s=0x0x8972F4DFDC6DC026; b=iQIzBAABCgAdFiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmDJGdAACgkQiXL039xtwCYcLQ/9Fvd Nj3Ll/zeOLGt4PGGxze7JbJepy6cH2wDJQu1BGatCL+4bWg4QpvEe+csymzkSrAQMNFJ0AQdds7V4 T03C0ur2CxGfQHjbXlsbY3fy+kXqQrpPhsy9lacKCIgVqyhHsneOQy5xinFCW8zAetopb+NA+1Z7E P3nl32yC7gccP3/r1ssROCOI2WECYoalwccWeJrVgPgqmf35b0DrGeLWQEQo5t4SwS4B70WW4vcRM E/Po3vNo9kJuV97hOWqHZD+XTyZY9/CQ0uODLRHOJbKUoLHAa3FJhLuLJm+uymdKNBhJsC8pQhltX fMK5pC1nt7djnQSf/HgiqoOYrv5xGyu10iNJodPdzqZ23txGygAOzNQlrguzMD3g7p1YZSBgtJSSL vl6D1uJiwOk4eaoAmciNSJRJc5K6zuLkpYj8zVoz5iOtLixKuI+EZtWC9GF2Zeru4MmoGSNNx6qow Qxeu2bjjjP5W9oWn6Nh0zUmf+foxqIeO9adkx2Eyzr83Uo6hgDyABe99QNrsIaOXg+T6nY7AWIC1V ysKqB+ppSsmq2R5RNUMk/neYiE5hDXOatnAVEqcDpBsqVQis/TYgYa0BB9kNEoLMuQ8gng+8q2M8g 1b2AifpUOmoQQsNqq8F71g3E7qFwMgIRNhi+csIJIkMJB42qKu6bwaxYjG5CWsBM= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210615_142128_968134_8E5BF983 X-CRM114-Status: GOOD ( 28.86 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Information was redundant between struct pstore_zone_info and struct pstore_device_info. Use struct pstore_zone_info, with member name "zone". Additionally untangle the logic for the "best effort" block device instance. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:431 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Information was redundant between struct pstore_zone_info and struct pstore_device_info. Use struct pstore_zone_info, with member name "zone". Additionally untangle the logic for the "best effort" block device instance. Signed-off-by: Kees Cook --- drivers/mtd/mtdpstore.c | 10 +-- fs/pstore/blk.c | 141 ++++++++++++++++++------------------- include/linux/pstore_blk.h | 27 +------ 3 files changed, 75 insertions(+), 103 deletions(-) diff --git a/drivers/mtd/mtdpstore.c b/drivers/mtd/mtdpstore.c index a3ae8778f6a9..e13d42c0acb0 100644 --- a/drivers/mtd/mtdpstore.c +++ b/drivers/mtd/mtdpstore.c @@ -423,13 +423,13 @@ static void mtdpstore_notify_add(struct mtd_info *mtd) longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize)); cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL); - cxt->dev.total_size = mtd->size; /* just support dmesg right now */ cxt->dev.flags = PSTORE_FLAGS_DMESG; - cxt->dev.read = mtdpstore_read; - cxt->dev.write = mtdpstore_write; - cxt->dev.erase = mtdpstore_erase; - cxt->dev.panic_write = mtdpstore_panic_write; + cxt->dev.zone.read = mtdpstore_read; + cxt->dev.zone.write = mtdpstore_write; + cxt->dev.zone.erase = mtdpstore_erase; + cxt->dev.zone.panic_write = mtdpstore_panic_write; + cxt->dev.zone.total_size = mtd->size; ret = register_pstore_device(&cxt->dev); if (ret) { diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c index 8f5bd656cc2d..e5ed118683b1 100644 --- a/fs/pstore/blk.c +++ b/fs/pstore/blk.c @@ -92,7 +92,7 @@ MODULE_PARM_DESC(blkdev, "block device for pstore storage"); */ static DEFINE_MUTEX(pstore_blk_lock); static struct file *psblk_file; -static struct pstore_zone_info *pstore_zone_info; +static struct pstore_device_info *pstore_device_info; #define check_size(name, alignsize) ({ \ long _##name_ = (name); \ @@ -105,68 +105,60 @@ static struct pstore_zone_info *pstore_zone_info; _##name_; \ }) +#define verify_size(name, alignsize, enabled) { \ + long _##name_; \ + if (enabled) \ + _##name_ = check_size(name, alignsize); \ + else \ + _##name_ = 0; \ + /* synchronize visible module parameters to result. */ \ + name = _##name_ / 1024; \ + dev->zone.name = _##name_; \ + } + static int __register_pstore_device(struct pstore_device_info *dev) { int ret; lockdep_assert_held(&pstore_blk_lock); - if (!dev || !dev->total_size || !dev->read || !dev->write) { + if (!dev || !dev->zone.total_size || !dev->zone.read || !dev->zone.write) { if (!dev) - pr_err("NULL device info\n"); + pr_err("NULL pstore_device_info\n"); else { - if (!dev->total_size) + if (!dev->zone.total_size) pr_err("zero sized device\n"); - if (!dev->read) + if (!dev->zone.read) pr_err("no read handler for device\n"); - if (!dev->write) + if (!dev->zone.write) pr_err("no write handler for device\n"); } return -EINVAL; } /* someone already registered before */ - if (pstore_zone_info) + if (pstore_device_info) return -EBUSY; - pstore_zone_info = kzalloc(sizeof(struct pstore_zone_info), GFP_KERNEL); - if (!pstore_zone_info) - return -ENOMEM; - /* zero means not limit on which backends to attempt to store. */ if (!dev->flags) dev->flags = UINT_MAX; -#define verify_size(name, alignsize, enabled) { \ - long _##name_; \ - if (enabled) \ - _##name_ = check_size(name, alignsize); \ - else \ - _##name_ = 0; \ - name = _##name_ / 1024; \ - pstore_zone_info->name = _##name_; \ - } - + /* Copy in module parameters. */ verify_size(kmsg_size, 4096, dev->flags & PSTORE_FLAGS_DMESG); verify_size(pmsg_size, 4096, dev->flags & PSTORE_FLAGS_PMSG); verify_size(console_size, 4096, dev->flags & PSTORE_FLAGS_CONSOLE); verify_size(ftrace_size, 4096, dev->flags & PSTORE_FLAGS_FTRACE); -#undef verify_size - - pstore_zone_info->total_size = dev->total_size; - pstore_zone_info->max_reason = max_reason; - pstore_zone_info->read = dev->read; - pstore_zone_info->write = dev->write; - pstore_zone_info->erase = dev->erase; - pstore_zone_info->panic_write = dev->panic_write; - pstore_zone_info->name = KBUILD_MODNAME; - pstore_zone_info->owner = THIS_MODULE; - - ret = register_pstore_zone(pstore_zone_info); - if (ret) { - kfree(pstore_zone_info); - pstore_zone_info = NULL; - } + dev->zone.max_reason = max_reason; + + /* Initialize required zone ownership details. */ + dev->zone.name = KBUILD_MODNAME; + dev->zone.owner = THIS_MODULE; + + ret = register_pstore_zone(&dev->zone); + if (ret == 0) + pstore_device_info = dev; + return ret; } /** @@ -193,10 +185,9 @@ EXPORT_SYMBOL_GPL(register_pstore_device); static void __unregister_pstore_device(struct pstore_device_info *dev) { lockdep_assert_held(&pstore_blk_lock); - if (pstore_zone_info && pstore_zone_info->read == dev->read) { - unregister_pstore_zone(pstore_zone_info); - kfree(pstore_zone_info); - pstore_zone_info = NULL; + if (pstore_device_info && pstore_device_info == dev) { + unregister_pstore_zone(&dev->zone); + pstore_device_info = NULL; } } @@ -230,12 +221,9 @@ static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes, /* * This takes its configuration only from the module parameters now. */ -static int __register_pstore_blk(const char *devpath) +static int __register_pstore_blk(struct pstore_device_info *dev, + const char *devpath) { - struct pstore_device_info dev = { - .read = psblk_generic_blk_read, - .write = psblk_generic_blk_write, - }; int ret = -ENODEV; lockdep_assert_held(&pstore_blk_lock); @@ -252,9 +240,9 @@ static int __register_pstore_blk(const char *devpath) goto err_fput; } - dev.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode); + dev->zone.total_size = i_size_read(I_BDEV(psblk_file->f_mapping->host)->bd_inode); - ret = __register_pstore_device(&dev); + ret = __register_pstore_device(dev); if (ret) goto err_fput; @@ -268,18 +256,6 @@ static int __register_pstore_blk(const char *devpath) return ret; } -static void __unregister_pstore_blk(struct file *device) -{ - struct pstore_device_info dev = { .read = psblk_generic_blk_read }; - - lockdep_assert_held(&pstore_blk_lock); - if (psblk_file && psblk_file == device) { - __unregister_pstore_device(&dev); - fput(psblk_file); - psblk_file = NULL; - } -} - /* get information of pstore/blk */ int pstore_blk_get_config(struct pstore_blk_config *info) { @@ -329,13 +305,27 @@ static int __init pstore_blk_init(void) int ret = 0; mutex_lock(&pstore_blk_lock); - if (!pstore_zone_info && best_effort && blkdev[0]) { - ret = __register_pstore_blk(early_boot_devpath(blkdev)); - if (ret == 0 && pstore_zone_info) - pr_info("attached %s:%s (%zu) (no dedicated panic_write!)\n", - pstore_zone_info->name, blkdev, - pstore_zone_info->total_size); + if (!pstore_device_info && best_effort && blkdev[0]) { + struct pstore_device_info *best_effort_dev; + + best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL); + if (!best_effort) { + ret = -ENOMEM; + goto unlock; + } + best_effort_dev->zone.read = psblk_generic_blk_read; + best_effort_dev->zone.write = psblk_generic_blk_write; + + ret = __register_pstore_blk(best_effort_dev, + early_boot_devpath(blkdev)); + if (ret) + kfree(best_effort_dev); + else + pr_info("attached %s (%zu) (no dedicated panic_write!)\n", + blkdev, best_effort_dev->zone.total_size); } + +unlock: mutex_unlock(&pstore_blk_lock); return ret; @@ -345,15 +335,18 @@ late_initcall(pstore_blk_init); static void __exit pstore_blk_exit(void) { mutex_lock(&pstore_blk_lock); - if (psblk_file) - __unregister_pstore_blk(psblk_file); - else { - struct pstore_device_info dev = { }; - - if (pstore_zone_info) - dev.read = pstore_zone_info->read; - __unregister_pstore_device(&dev); + /* Unregister and free the best_effort device. */ + if (psblk_file) { + struct pstore_device_info *dev = pstore_device_info; + + __unregister_pstore_device(dev); + kfree(dev); + fput(psblk_file); + psblk_file = NULL; } + /* If we've been asked to unload, unregister any registered device. */ + if (pstore_device_info) + __unregister_pstore_device(pstore_device_info); mutex_unlock(&pstore_blk_lock); } module_exit(pstore_blk_exit); diff --git a/include/linux/pstore_blk.h b/include/linux/pstore_blk.h index 99564f93d774..924ca07aafbd 100644 --- a/include/linux/pstore_blk.h +++ b/include/linux/pstore_blk.h @@ -10,36 +10,15 @@ /** * struct pstore_device_info - back-end pstore/blk driver structure. * - * @total_size: The total size in bytes pstore/blk can use. It must be greater - * than 4096 and be multiple of 4096. * @flags: Refer to macro starting with PSTORE_FLAGS defined in * linux/pstore.h. It means what front-ends this device support. * Zero means all backends for compatible. - * @read: The general read operation. Both of the function parameters - * @size and @offset are relative value to bock device (not the - * whole disk). - * On success, the number of bytes should be returned, others - * means error. - * @write: The same as @read, but the following error number: - * -EBUSY means try to write again later. - * -ENOMSG means to try next zone. - * @erase: The general erase operation for device with special removing - * job. Both of the function parameters @size and @offset are - * relative value to storage. - * Return 0 on success and others on failure. - * @panic_write:The write operation only used for panic case. It's optional - * if you do not care panic log. The parameters are relative - * value to storage. - * On success, the number of bytes should be returned, others - * excluding -ENOMSG mean error. -ENOMSG means to try next zone. + * @zone: The struct pstore_zone_info details. + * */ struct pstore_device_info { - unsigned long total_size; unsigned int flags; - pstore_zone_read_op read; - pstore_zone_write_op write; - pstore_zone_erase_op erase; - pstore_zone_write_op panic_write; + struct pstore_zone_info zone; }; int register_pstore_device(struct pstore_device_info *dev); From patchwork Tue Jun 15 21:21:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1492504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=msxXF9h2; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ExHsShel; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4Nl33sC7z9sCD for ; Wed, 16 Jun 2021 08:48:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8W+YfkA3U2nh+0vnHFODb+sp2QJ/zJ6cTnTSfv0vFkI=; b=msxXF9h2xc32dt tA+g2ZzCS/r1BqJlFQ0n0/O4wT0p0jc7OpG4dbmHqPSb9YGhd5roiYbA2zqN9mO4Zab2WLJ2ctaRD aKUZRHZ/PA3CvcZmwc2Rr1n+VwzOO3BJht000/iKd8gPx7QNnBwmj4GkHRVDGJ1DINMCicLfaTYOu cAw0wzViRemkjJkFJlHdZmoESUfn0LVRwYefW473BhDQyNT4Zp5crb/smiRfNGv3VM1nCOyScjFTY af/1aN3fZ3tvfmbeOQseg0EgFcZAr1tYqAN724yP1Krc0hMFoYatmwIIBUloqK6VNQR781rMf6j7Z 0EEdXPu/tpO2ngbm2Zag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltHqB-003gWY-Ek; Tue, 15 Jun 2021 22:47:27 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltGUw-0036iN-EG for linux-mtd@lists.infradead.org; Tue, 15 Jun 2021 21:21:28 +0000 Received: by mail-pf1-x433.google.com with SMTP id s14so446825pfd.9 for ; Tue, 15 Jun 2021 14:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1WsCoFrZUeCb0I6fGREpg1RRrP6pUhfJxmr65OEW+zI=; b=ExHsShelnJC1ZujVqA5L/hh0NvxQMBhXN2MULuE6mmK+LgF0GZw9HVc3a8QIkI3dKf rQcXcD7kGknLCUvv8mNZBl38OHiy9EPcaWssQ7LcN0xvLIKgsVw7ETKXgxoO9LStcKQh 8gilmRAKZkmJOi+h73XODDh65FCzh7QUsySwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1WsCoFrZUeCb0I6fGREpg1RRrP6pUhfJxmr65OEW+zI=; b=T/scZ+BPd1yjc7Sqz7Nz89fTgwLa4C6bX6/ADql1ESQQrRt2opyohmVo0OlmNuvRuC 5NE8vchR1GSQG4ix4PTsAE1VBACzb0m/AHYsSrZpokI6+tPQoWIBop1fiQ+WbUuBIi7X /sj2FoNhsFzpPzIJbL3oaTEK0Y0VBdM/khcF1XarrSqmO+D/+yleg4ST1Avwc2QGRV45 itFT9eWh+Bgz6ITodfqhJYG/wje3Satq6+c7AgXEB6+6gOFja2oAH961L4oZGz993M8H o66fW9oxyrXLqVbftSD95EIY0IoRDYJJXKm4L/g8gpAqdk7pVeM56wdsjDfhn7X8bcFU oRfg== X-Gm-Message-State: AOAM531II5wLUvx355mtaC202S531Shq1ddcNQmDdzlh4za5PpC0SefX XZzbEDVSZD59DIffv+GBm6GKLw== X-Google-Smtp-Source: ABdhPJwZ6dQpDmP5yqVDdThGzD8bpvZ2yTrYL5QSdc6qOqCFdVutpzCaBenqXSN3cOdGGaWGzve9vg== X-Received: by 2002:a63:d305:: with SMTP id b5mr1507673pgg.67.1623792085651; Tue, 15 Jun 2021 14:21:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k6sm80428pfa.215.2021.06.15.14.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 14:21:24 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Christoph Hellwig , Al Viro , gmpy.liaowx@gmail.com, Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-doc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v2 4/4] pstore/blk: Fix kerndoc and redundancy on blkdev param Date: Tue, 15 Jun 2021 14:21:21 -0700 Message-Id: <20210615212121.1200820-5-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615212121.1200820-1-keescook@chromium.org> References: <20210615212121.1200820-1-keescook@chromium.org> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; g=40eac1b7c9cd225ba517a3879c498704663ed315; i=yTEuvN+d2QlI+CgetW2A/mnEULnwbC3Uy5kOoKgmB9Q=; m=yIDjiAw9ImVPRu6Ts4rM6ctqS+8yW+yfMUIAkNmTcxE=; p=TXx6XCuoWJyqy7rsksng3VTp82hOVpLmF4DnpkYUm+I= X-Patch-Sig: m=pgp; i=keescook@chromium.org; s=0x0x8972F4DFDC6DC026; b=iQIzBAABCgAdFiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmDJGdAACgkQiXL039xtwCabvA//f2d ouRC3eMe4By1s5gm+kgCGLji4A5jmvfWvuteZkPHrsEAhxzfe5FDa8OXvGRvElGR/imgzjGKMCaFu 3LDUFU5/2igZpyDqhOFZas4pGIgmgNFmxdS/a0KdkXwQiTTdKe8hffEGtZtwW2v6q2MSxnh3DcIxJ iPMFxWRz7TXHJQuBmVNlOCCCVJ+lE5oZy0VMo8GlcbMZrDqQ71eMGvEW0venFXiLrHrAukJUj+OHx Ks5XzrUSZdPgVN8clVdt7+Jfrh1r+HrdTjq8CE8mmvwNL/su/1i2CH52msFFHn4MF/yn3OjNxTzfi kmqwJmlKC7bx5C+D1mpIvNav5DTupfQGafxkYtyhuQfiPGi/Lp72svaD1wTTjY7AEMG51Zqy1IsKk qPC16uxbn3VAtGEDtT3KvDocAciZdTg7EQ6MwjgznzKWO2kHQY0XqZo2/yqtzDcQyLo9HB8JGjNmr P7w4VmVmtZL0idygwnih2lzc2MpD9Buzeik3jOk57K1e6PF6+EFlIDeRTKpbO/JbuhBTRab4G9USD Km/i/73fVcgRXEIt+isU8smkNLPfEQk9RK/gzlIByu+sPQJsYqSQRQ0tfzlpy1gjTCISXkBVU/ClM ZAuaMtt9Qc07acYesdxXHuGQajsdrCjZcPmxYLzi4szH1kvQoSrwp5lMyhBkA85k= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210615_142126_554248_E7E5E0F9 X-CRM114-Status: GOOD ( 16.58 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Remove redundant details of blkdev and fix up resulting kerndoc. Signed-off-by: Kees Cook --- Documentation/admin-guide/pstore-blk.rst | 14 +++++++------- fs/pstore/blk.c | 24 + 2 files changed, 8 insertions(+), 30 del [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:433 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Remove redundant details of blkdev and fix up resulting kerndoc. Signed-off-by: Kees Cook Reviewed-by: Christoph Hellwig --- Documentation/admin-guide/pstore-blk.rst | 14 +++++++------- fs/pstore/blk.c | 24 +----------------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/Documentation/admin-guide/pstore-blk.rst b/Documentation/admin-guide/pstore-blk.rst index 49d8149f8d32..2d22ead9520e 100644 --- a/Documentation/admin-guide/pstore-blk.rst +++ b/Documentation/admin-guide/pstore-blk.rst @@ -45,15 +45,18 @@ blkdev The block device to use. Most of the time, it is a partition of block device. It's required for pstore/blk. It is also used for MTD device. -It accepts the following variants for block device: +When pstore/blk is built as a module, "blkdev" accepts the following variants: -1. device number in hexadecimal represents itself; no - leading 0x, for example b302. -#. /dev/ represents the device number of disk +1. /dev/ represents the device number of disk #. /dev/ represents the device number of partition - device number of disk plus the partition number #. /dev/p - same as the above; this form is used when disk name of partitioned disk ends with a digit. + +When pstore/blk is built into the kernel, "blkdev" accepts the following variants: + +#. device number in hexadecimal representation, + with no leading 0x, for example b302. #. PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF represents the unique id of a partition if the partition table provides it. The UUID may be either an EFI/GPT UUID, or refer to an MSDOS partition using the format SSSSSSSS-PP, @@ -227,8 +230,5 @@ For developer reference, here are all the important structures and APIs: .. kernel-doc:: include/linux/pstore_zone.h :internal: -.. kernel-doc:: fs/pstore/blk.c - :internal: - .. kernel-doc:: include/linux/pstore_blk.h :internal: diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c index e5ed118683b1..ccfb11ee4d50 100644 --- a/fs/pstore/blk.c +++ b/fs/pstore/blk.c @@ -58,29 +58,7 @@ MODULE_PARM_DESC(best_effort, "use best effort to write (i.e. do not require sto /* * blkdev - the block device to use for pstore storage - * - * Usually, this will be a partition of a block device. - * - * blkdev accepts the following variants, when built as a module: - * 1) /dev/ represents the device number of disk - * 2) /dev/ represents the device number - * of partition - device number of disk plus the partition number - * 3) /dev/p - same as the above, that form is - * used when disk name of partitioned disk ends on a digit. - * - * blkdev accepts the following variants when built into the kernel: - * 1) device number in hexadecimal representation, - * with no leading 0x, for example b302. - * 2) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the - * unique id of a partition if the partition table provides it. - * The UUID may be either an EFI/GPT UUID, or refer to an MSDOS - * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero- - * filled hex representation of the 32-bit "NT disk signature", and PP - * is a zero-filled hex representation of the 1-based partition number. - * 3) PARTUUID=/PARTNROFF= to select a partition in relation to - * a partition with a known unique id. - * 4) : major and minor number of the device separated by - * a colon. + * See Documentation/admin-guide/pstore-blk.rst for details. */ static char blkdev[80] = CONFIG_PSTORE_BLK_BLKDEV; module_param_string(blkdev, blkdev, 80, 0400);