From nobody Fri Jul 15 18:04:07 2022 X-Original-To: dev-commits-src-main@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 4Lkzkv6WxVz4TGmZ; Fri, 15 Jul 2022 18:04:07 +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 4Lkzkv3mgWz3SBn; Fri, 15 Jul 2022 18:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908247; 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=0ZuAKJTxNg989TVDRDiSX2KuuQ0vME2dg3UIe4lctTc=; b=Tr/E3EzYIC5ODWPYhRNgwM5D7SWOyf4LDfQO0ongASlJF0Lndspcb/vlR9L9XNMwSUzo1q H1gB1sXqV7/5+pe6ktYYb4MaQ9w5I4MaVzBB8Lq8hkNfJ4SykbGG7aJ0zF9gtFmHtUgfNQ kV3pw58+1adEH+5WBjwGMpVF46aRdqfOfQXMGDIj0Uzgwgl+v8//zzTpJcj+udU+DZx0ps bPOrrvvELnrWG3JxMbKHFDEN/KUfTvk3mhkmFE9pYIMldV7oxvzlN9X/jNC9x6jXX7cQkf 0IoixaPUePUChb06HveycR6gd+HHFs52bvkSDEp+5IF3W2sVQqRoTWlvSdMZ9w== 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 4Lkzkv2t2WzrNm; Fri, 15 Jul 2022 18:04:07 +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 26FI47gY060410; Fri, 15 Jul 2022 18:04:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26FI478Y060409; Fri, 15 Jul 2022 18:04:07 GMT (envelope-from git) Date: Fri, 15 Jul 2022 18:04:07 GMT Message-Id: <202207151804.26FI478Y060409@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: 2870493f1f55 - main - kboot: Properly cap number of segments loaded for kexec List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 2870493f1f55d5c00e5593f336dc05805863db7f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908247; 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=0ZuAKJTxNg989TVDRDiSX2KuuQ0vME2dg3UIe4lctTc=; b=AUXBWdBlZYj8P5nWltgXYA+ZX7Toz1KDQ0lemqjWGUNukbCztqsZ6DgN2aGNK/+7HeBcYw Iimq3rRUtyQhta08yVKI1SFTzwH/M9swU9M9LICKCjnxur6uNCw2V+yMJ9N5/lfIHx/uv5 Q2LAcLIJliENvfVGmYzzNXMlbcqCn6EjqfADK7drwca0PQKoUnmHkWEqnUelQYA/WlMCVj 8QzqPuWSxSjyxJH4e/X5Cp7kcpwvSu1dE8mIdHZxxZmYLCrUo6bmXYNeD7D5BghpWFPo6+ /9walAHdO9lpSaLPPbqZnSBU/CgJ39mi216PHmnqPpG6TJ81MGzon6iwQFAluQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657908247; a=rsa-sha256; cv=none; b=ay/v98YUL9Z+Uapri8m/p6ntQQT3qt+mva4XB1Gy7lPOCy+cH5jsiTfygsilb1pSaWzXZY 4toVeAzppxUk4gCZ4VIYaY/IV1/jKTEqZJySfk/igzYbzDLgVV4aEpJulv3ks95UKtUJ/7 trmjlugbjtGlL0n3gdKAULqvu55z3VxLHWzzqBlRfSU/i7XKw0Y35S0OTbHPKtR1Ta86X1 Dai05hEEIlLJFMsNincTGVqvzjSERT8UF+/pQc+CgpTjxftOPHRPfOmJdGDAVbFnKom3kE w6TxTBnPDUfUE4Lg31u2/IhLsS81BDb4Z2Kn/5UjZPFIqvyK0+NePOJ+H6muVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2870493f1f55d5c00e5593f336dc05805863db7f commit 2870493f1f55d5c00e5593f336dc05805863db7f Author: Warner Losh AuthorDate: 2022-06-29 22:31:23 +0000 Commit: Warner Losh CommitDate: 2022-07-15 18:00:51 +0000 kboot: Properly cap number of segments loaded for kexec Linux has an arbitrary limit of 16 segments. Make sure we don't load too many. Sponsored by: Netflix --- stand/kboot/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stand/kboot/main.c b/stand/kboot/main.c index 79c03398ba6d..83ad0ceb8a18 100644 --- a/stand/kboot/main.c +++ b/stand/kboot/main.c @@ -340,15 +340,17 @@ time(time_t *tloc) return (rv); } -struct host_kexec_segment loaded_segments[128]; +struct host_kexec_segment loaded_segments[HOST_KEXEC_SEGMENT_MAX]; int nkexec_segments = 0; static ssize_t get_phys_buffer(vm_offset_t dest, const size_t len, void **buf) { int i = 0; - const size_t segsize = 4*1024*1024; + const size_t segsize = 8*1024*1024; + if (nkexec_segments == HOST_KEXEC_SEGMENT_MAX) + panic("Tried to load too many kexec segments"); for (i = 0; i < nkexec_segments; i++) { if (dest >= (vm_offset_t)loaded_segments[i].mem && dest < (vm_offset_t)loaded_segments[i].mem +