From nobody Sat Jan 7 20:22:37 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NqBTT2bCxz2p2fj; Sat, 7 Jan 2023 20:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NqBTT1wWrz3p5f; Sat, 7 Jan 2023 20:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673122957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VW1ldUITl7HL1VoA8bukYElLoj/9OMXJfwADET2MVzQ=; b=j/CT4mcKDm9K1WICsvWmujhBhKU0pNITtF8kW/EaotMR2K51C3gzSdt0kA6CM/JeuJ0Tsb 9ZuVtEsq3Oa3aWyzuRN6lukg2xgzAjpBS6PTMMxLkjlO2l0Q4sDB0k/TAgdbjS/tordjcd t+62JOoXt1xlcxIHebejjA7LME3jeTEFRbcbBzd7X2a/nDz8poQYno5YUROSGQPmMbxqe4 T//Q1lcdR1uKYUXEyF3P1G1ecXG6oyfM9STzLY0lc+mOYfTgTRiyzMFq/qzyiecFJiS8cy xdZFf5biqBfDLpc4BqZv9+qw3EHjv+6zAtLXojpbXfRYrbtszmo1o6BuVncbkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673122957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VW1ldUITl7HL1VoA8bukYElLoj/9OMXJfwADET2MVzQ=; b=Nof4EsW8nsXOGmosXGDfECNjIgLyYXPy58DHk8Nse1q4UarmkB1t1GUmy3Pqan9SW8KCXH 53pyZKZh32tLdNLxkgQDuSmA+pCsgcD0nQkCl4VpFRgXagnqntNhkNvwagZdcrxVAIDE82 LJ96TRcmK3P348k4fIGqbdmyrs/04VsEZAxLzx9fXwby5ep/LEDwjz72sQ0e8J3kqjKdSE ZKmYwzHtdUBP7lyExrXryyp1cERiKGFReuhFMk2L+znIfYQw4HupwOhMccMzvS8KisgcVC witwvHnFe+bp0isPoih0Qm2jqZkkYsp9ivTxEErmNKuw8Uo8vIiQSOmujpTyiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673122957; a=rsa-sha256; cv=none; b=POAVAhFPBVORZUSZx2dQuGLKL0PpOb2qoeWRICPE4toHU5ovEpcVX6Dhg3Sn5rMswMaSWp iwxLOwZe5YVF1eojgV1yLR1WVzSNV8fdtXJT1Xuw6IPCNx6SiWok6e5BcVZU8v3HRLC3Wv npldrQ//s8CtWeGQB/zKjHqCDDldV8b5W4rg7Ip0sY+vXnGnINNgjalqHrHTUPk32i6rk3 eiJB4AttopbHqi8TBb+U+7UIfXt9xj+UEkGogJHtE7fcpg9QPQhjLExNkMzFqWUpQgl1nb hQYPe8dZ20oss4py0EaOneTYsVkkc2NuJtT9vSJn3KYmXFCmRt9T/ZvZ7syXgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NqBTT0qljzMcD; Sat, 7 Jan 2023 20:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 307KMbe2069850; Sat, 7 Jan 2023 20:22:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 307KMbdP069849; Sat, 7 Jan 2023 20:22:37 GMT (envelope-from git) Date: Sat, 7 Jan 2023 20:22:37 GMT Message-Id: <202301072022.307KMbdP069849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0386255bee07 - main - kboot: Disks should be at least 16MB List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0386255bee079922f00f37eeb4e9e3138b7666c1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0386255bee079922f00f37eeb4e9e3138b7666c1 commit 0386255bee079922f00f37eeb4e9e3138b7666c1 Author: Warner Losh AuthorDate: 2022-12-13 05:39:03 +0000 Commit: Warner Losh CommitDate: 2023-01-07 20:20:44 +0000 kboot: Disks should be at least 16MB Linux pre-boot environments will often have a number of psuedo disks that are small, all smaller than a few MB. 16MB is a good cutoff since it's big enough to filter these devices, yet small enough to allow a super-minimal partition through (the smallest I've been able to make that's useful lately is around 20MB). Sponsored by: Netflix --- stand/kboot/hostdisk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stand/kboot/hostdisk.c b/stand/kboot/hostdisk.c index bc31bef8e6d0..628450ef8bb5 100644 --- a/stand/kboot/hostdisk.c +++ b/stand/kboot/hostdisk.c @@ -60,6 +60,8 @@ struct devsw hostdisk = { */ #define SYSBLK "/sys/block" +#define HOSTDISK_MIN_SIZE (16ul << 20) /* 16MB */ + typedef STAILQ_HEAD(, hdinfo) hdinfo_list_t; typedef struct hdinfo { STAILQ_ENTRY(hdinfo) hd_link; /* link in device list */ @@ -162,6 +164,8 @@ hostdisk_add_drive(const char *drv, uint64_t secs) if (!file2u64(fn, &hd->hd_sectorsize)) goto err; hd->hd_size = hd->hd_sectors * hd->hd_sectorsize; + if (hd->hd_size < HOSTDISK_MIN_SIZE) + goto err; hd->hd_flags = 0; STAILQ_INIT(&hd->hd_children); printf("/dev/%s: %ju %ju %ju\n",