Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2858197rdb; Tue, 12 Sep 2023 14:34:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEyGABe2Mxs/YNn+EHu4X9nkAub1Iw7Ximda7H/YjspL/8FkJGivroJU0uS3WU7C8LdF/F X-Received: by 2002:a05:6870:c225:b0:1d0:fd8d:2a10 with SMTP id z37-20020a056870c22500b001d0fd8d2a10mr891742oae.44.1694554454727; Tue, 12 Sep 2023 14:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694554454; cv=none; d=google.com; s=arc-20160816; b=d6r9SNDv7nQIv8UoYRm0J+cJfyYuxA9oyPZ7YEeVNowCzKMe0KU1bmuwfSGACF51dr LaBYh0SubaeUDcFBTnMQVMSsYnBLoR/Jh1X8mrPqtcsFRvit/STRdTCKZVQrXCrzqERV Y69KZsQTki/U5WDBp0sEN+5TZRDBLwIHPqyEPY++SFbO3+IOyR2KvE3uCWh4tF6aC+B4 PjnaJYgc/m4O7AkYmtElvqYQLYi52fMZhXmXh7EZJDCrN7M9vXDYq+HZAiRzOO3w6s5D 68fJzd4N/MsgysML5e4nZVv56PflxK6jBL9ikKD8GFnPIdyp9UaLLg+ZOKdVhuUIfm9A n3Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=U9NX1eydLNVgshySZmGjlq5b77lgR7szWd7VFgL+D3U=; fh=WGxnbchXB1nh8WtfYTQqAYq5ggcl91wEfddYAfjE7VI=; b=Y8OeINwN3UgOHoFq1Tf3a/7h1r3ndEeUfLeX481bwQLn1sYVHrMowUQjQUBMummslF bUFmXgeko9fiNhAiVR8riXquzqpbYGueoeEfpF+u+rtfyAPVQCw1UWaiXkqABUxC5iXQ nZEcy9oAO+OM3mHjDaFiOJa8eZbHhJT6LIXP6qOnsTf2coX4kK3WZ9aiGE8Ju4Tc9naC O1yTbwFoIWfGFGx0xBIPEO5Vgxr715fSLJIwYmFC3hODk8O1hWPVSPM119wxx/MTXpJi FFMdHGxiBy3xAKoUwYRWYt48kF4MY7rwuGTPhAH27aTwANqqbL5+1NMJgJ2MIGVaafLg h6Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C0xPLuuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i7-20020a63cd07000000b0056956177395si8184601pgg.512.2023.09.12.14.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 14:34:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C0xPLuuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C5A9E840FE0E; Tue, 12 Sep 2023 02:02:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbjILJCb (ORCPT + 99 others); Tue, 12 Sep 2023 05:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbjILJBj (ORCPT ); Tue, 12 Sep 2023 05:01:39 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA48110E9 for ; Tue, 12 Sep 2023 02:01:35 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-592210fe8easo63388997b3.3 for ; Tue, 12 Sep 2023 02:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694509295; x=1695114095; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=U9NX1eydLNVgshySZmGjlq5b77lgR7szWd7VFgL+D3U=; b=C0xPLuufuvl7kiWJRzV3g+tm2SoPvFQh/KPjCEK+pHQGsnBwa7MiOcpYAndaj6NozO jMzGALPMLhL6Y3t5zqj1aCnNhrh4w7QMh+Zimza6f8E5rg+IF8WOLVrxFazXT8P5YV2/ 5smX4Par+98w1Oyp90elBxJ5vYYXrBdsFtaEtTMjmPVJcZfWJnHFiYw48S6ZvynPL2Fh r8RtOX7Iwvr/8GU1yzsv2Bllv9pSTsJIkMqNpW6DkglK9XkZy9HDnXzWaeWsg+TehOa2 Kn26O8/Z6pDuI8R5bf8RVfza47vqFlaHTzjUxdVAAwvFEl0YO3MydhLS0QCk8Hw4PILz lVAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694509295; x=1695114095; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U9NX1eydLNVgshySZmGjlq5b77lgR7szWd7VFgL+D3U=; b=B2mvDXN0sQziPZ/MrvnlfKfmimURKMfVberjglUS1a1Oq432GSq+KL2NWH+p9pYoHa 60gOVrS0hEM9f2kwsaTmb0h2yA9O+JikD9/BcK+7MRWHqWKTIMuZQ6D/jwYS8uYngtsa 2uk32i487GeIK8p0Gy6Rjs0/4Cu4qov/rtEPvXFylC0h9e2laleTmga0XmR6yiHsxVg+ rYJRf8IO6W38tyQI2c1wZ1JW0H1SVtbOayziCbmplqIFXT4Bv94b12R7SlmScqgZDAwE wxaevgffpjjM9ry4BBhBcVlvlj3W8eIT3AUHS5JXc+kzjWwNYdyDF3dLlAwyVbB8f9+C M6ag== X-Gm-Message-State: AOJu0YwFB0PepJx+EwsI9NlN09UOt2x8cmTGlGVXU+SNb8UYVSODApG+ B3hZGrQ6Xbn/nJSxybE4c6QCtsAb X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a25:bb88:0:b0:d7b:8acc:beb8 with SMTP id y8-20020a25bb88000000b00d7b8accbeb8mr283729ybg.2.1694509294977; Tue, 12 Sep 2023 02:01:34 -0700 (PDT) Date: Tue, 12 Sep 2023 09:00:55 +0000 In-Reply-To: <20230912090051.4014114-17-ardb@google.com> Mime-Version: 1.0 References: <20230912090051.4014114-17-ardb@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=3047; i=ardb@kernel.org; h=from:subject; bh=C3Y0JXoFsDu7p0NCuFXkHN3nsg72k1sfp0MTO1muukQ=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIZVB40ToruN3lO8c3lF80q2mY/G0N02PllxzCJiv0bv5X +iFLx9ed5SyMIhxMMiKKbIIzP77bufpiVK1zrNkYeawMoEMYeDiFICJzPFl+Gfy0+pN1D1OT3vG pI1rZ3gpH1fYGxL8aPp8nYvCHivOvFnH8E/9oP+PaWwn7OKPfm96br+6X4FD6Yvq1Jl6nG/nlC6 crMwBAA== X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230912090051.4014114-21-ardb@google.com> Subject: [PATCH v2 04/15] x86/boot: Remove the 'bugger off' message From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Evgeniy Baskov , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Peter Jones , Matthew Garrett , Gerd Hoffmann , Kees Cook , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 02:02:36 -0700 (PDT) From: Ard Biesheuvel Ancient (pre-2003) x86 kernels could boot from a floppy disk straight from the BIOS, using a small real mode boot stub at the start of the image where the BIOS would expect the boot record (or boot block) to appear. Due to its limitations (kernel size < 1 MiB, no support for IDE, USB or El Torito floppy emulation), this support was dropped, and a Linux aware bootloader is now always required to boot the kernel from a legacy BIOS. To smoothen this transition, the boot stub was not removed entirely, but replaced with one that just prints an error message telling the user to install a bootloader. As it is unlikely that anyone doing direct floppy boot with such an ancient kernel is going to upgrade to v6.5+ and expect that this boot method still works, printing this message is kind of pointless, and so it should be possible to remove the logic that emits it. Let's free up this space so it can be used to expand the PE header in a subsequent patch. Acked-by: H. Peter Anvin (Intel) Signed-off-by: Ard Biesheuvel --- arch/x86/boot/header.S | 49 -------------------- arch/x86/boot/setup.ld | 7 +-- 2 files changed, 4 insertions(+), 52 deletions(-) diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 8c8148d751c6..b24fa50a9898 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -38,64 +38,15 @@ SYSSEG = 0x1000 /* historical load address >> 4 */ .code16 .section ".bstext", "ax" - - .global bootsect_start -bootsect_start: #ifdef CONFIG_EFI_STUB # "MZ", MS-DOS header .word MZ_MAGIC -#endif - - # Normalize the start address - ljmp $BOOTSEG, $start2 - -start2: - movw %cs, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %ss - xorw %sp, %sp - sti - cld - - movw $bugger_off_msg, %si - -msg_loop: - lodsb - andb %al, %al - jz bs_die - movb $0xe, %ah - movw $7, %bx - int $0x10 - jmp msg_loop - -bs_die: - # Allow the user to press a key, then reboot - xorw %ax, %ax - int $0x16 - int $0x19 - - # int 0x19 should never return. In case it does anyway, - # invoke the BIOS reset code... - ljmp $0xf000,$0xfff0 - -#ifdef CONFIG_EFI_STUB .org 0x38 # # Offset to the PE header. # .long LINUX_PE_MAGIC .long pe_header -#endif /* CONFIG_EFI_STUB */ - - .section ".bsdata", "a" -bugger_off_msg: - .ascii "Use a boot loader.\r\n" - .ascii "\n" - .ascii "Remove disk and press any key to reboot...\r\n" - .byte 0 - -#ifdef CONFIG_EFI_STUB pe_header: .long PE_MAGIC diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld index 49546c247ae2..b11c45b9e51e 100644 --- a/arch/x86/boot/setup.ld +++ b/arch/x86/boot/setup.ld @@ -10,10 +10,11 @@ ENTRY(_start) SECTIONS { . = 0; - .bstext : { *(.bstext) } - .bsdata : { *(.bsdata) } + .bstext : { + *(.bstext) + . = 495; + } =0xffffffff - . = 495; .header : { *(.header) } .entrytext : { *(.entrytext) } .inittext : { *(.inittext) } -- 2.42.0.283.g2d96d420d3-goog