From nobody Tue Jan 24 22:14:13 2023 X-Original-To: dev-commits-src-branches@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 4P1h8P6mB2z3bgfB; Tue, 24 Jan 2023 22:14:13 +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 4P1h8P65C1z3L8n; Tue, 24 Jan 2023 22:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598453; 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=0o6xvxRyqZl52QLMUFPyt7jzzk2SLLKd3SrffJLw3Mk=; b=xvRJkZf4qh7uh7bVaMZECKLP+x/hO6UsMCNYDnLYCXP8D2LqZ5CgoGA9Lypj6L2r/+lY2k u3XwWpIWm8UD6qf0d0zxz2NQg6lMtCDWuXu7cf/sAgeB4kFh2BcqHgHBhWBmIHDYNQ5vOI kq6+lhZ01NEM7rmeLcUmeECbgUExYP++epXSGpH2mMU8Jj+ZqspsyiPMjN35zP3yjnUF81 7N2Nt+3lQdhkJmcSs7wYj7n4gjhQimV021CPCVKj3dXp7WLuN0s7628GDTWCtdTti7IJUy sBqVzoB4edS7PDYgZXsZ1L59/AulZb7c1r5qzWMk+YIEoW+fQ76emBDFafsc1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598453; 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=0o6xvxRyqZl52QLMUFPyt7jzzk2SLLKd3SrffJLw3Mk=; b=GRebIRlQpmWFRvqVOSEAjK3+TuvoLWZQGh/o7BUcut/ceb5Kq5XknevWBz441aSe1t2xZ4 OrIJ2J5WJ2Mlt4O35mZThSQlyd7IknP9fAsD76IV1bYNjwiaVY9TmjOpVDKgK3VvAUYzlD 4iaHmbWtbLLasfGNXxI4u+kcOmM9zynmmRj5tXzcCF7PUp/09ur2ovwIgSFotcGVqI68T+ M/MZiwm06Byag9+tSJQzxPZeAWlMmMzRlNj1bvqJUqplopB7oBaq4VG+4ZIBqiuqz9X9d4 d+1uHXX3C7bEF5BPkAF2CJvKXPLGNm6Ruo1RJTYu53PwX7HuurC9V2fS9Iz1vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598453; a=rsa-sha256; cv=none; b=Xjxe55tR+SY6YFKyDP3IJTnwFFsrjcJM9bSC6+1VSoBsW2nLssyl2rxOtMyHgjfzVv33zF O5dFhsYjvBJmRT+BXEHMn68iNa//GqCYguQgUk3kxbwXQ4lVvH1yfe/G0O0W+9VgxYKtvR D1bTI/ls2oAeTglqcKxTXY3404UiQvEwD/WiltBduSmBpyi9XwJJVc5P3WRli4inHWD82C 2cr+lVfUl/vsNwfl4r9XzWhVBk/uhz+/l91w3QtacGWoWzVfeWuAoWcRyeX8xO53mYdsva i/MKWnRZWkYKQuXwmlm1X+ECHXcoSWZvtgb9UXSLy3QUtxNG1qZBgI8id7mexg== 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 4P1h8P4wsYzQW5; Tue, 24 Jan 2023 22:14:13 +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 30OMEDIN089524; Tue, 24 Jan 2023 22:14:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMED3X089523; Tue, 24 Jan 2023 22:14:13 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:14:13 GMT Message-Id: <202301242214.30OMED3X089523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 85d8155e9526 - stable/13 - kboot: Disks should be at least 16MB List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 85d8155e952613e03ab444947405ec0d9183e3b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=85d8155e952613e03ab444947405ec0d9183e3b0 commit 85d8155e952613e03ab444947405ec0d9183e3b0 Author: Warner Losh AuthorDate: 2022-12-13 05:39:03 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:45 +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 (cherry picked from commit 0386255bee079922f00f37eeb4e9e3138b7666c1) --- 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",