From patchwork Tue Oct 25 14:12:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeniy Baskov X-Patchwork-Id: 10824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1033234wru; Tue, 25 Oct 2022 07:15:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PiWdDslB0n3K2WYZuo/RySwzd25Mh2OQqGLXEu/athxXzYYFlDyPn6CpD8pFIfw1dNFyJ X-Received: by 2002:a17:903:2284:b0:180:289f:7f09 with SMTP id b4-20020a170903228400b00180289f7f09mr39469535plh.120.1666707340649; Tue, 25 Oct 2022 07:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666707340; cv=none; d=google.com; s=arc-20160816; b=MYkNYd78Xley7oCKcBpchJ1ajezrFTvXraNbBYD1QsoEAoPnZ1QiUXV5QNLq6OET49 fkYQ9mxTA/9mFBXRB8RwD0aBT3RRLwQ2beRg21gzPBsEE0ClD1Spk3UhoQCYTalG8vOc FY2cpYp8GbjCll1Apx2eBuuIMEaB4AApybdzfRwLJ0v7E3fpOthpNU6RPftDC5E9PZi2 GU1dRxJ1EVT9RrB9zWBKP8S2DXisNr8u1X93Ap10uVqGxe4L1L33ewa82TjBPnICUID2 uUlvkf5AlJHKxxXfSzb2GrXkEUd44HOf7SNjafNFBvScH/dh+4XPSGXf9IiYt+6SHNxl wRxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=HI18v3+f+Pl+YyhFoHiqU9HpwMvARvOP6MXeGpCdq1M=; b=C9lkhqzNebsuSqmkcZbVQxrH+qkvPswV2AGIbMrSC6jcg90b+PA4JPfpbOX02kjxVu DRXVUgtG7Hh9Gqbl07svg7mXbd+meIWs4oH4CNIieFBoWnKT4/5hTPUjOeGZS4kXqD5x K90l1/hLobxqKEGeN7ivy7IBkIHqJEYvTT2HYlAorP8Tt2D5aIP1f5QyUPDvQvkjLm+o mNN29uV4mQ/4Ri4/PfRX2hG68njuwMywadtnJSuHV2liaU45tIcWqtJD0lIijYcDSze5 z6GLQ3BHKhTB/cf9EAgbXQBmaEktv73y68frvrZVHV6d0HyLLBWp9BrPJjOD0K3RZ+Ei uRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=K4Rw76io; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b0044c3ec9ea71si2526843pge.630.2022.10.25.07.15.23; Tue, 25 Oct 2022 07:15:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=K4Rw76io; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233268AbiJYOOy (ORCPT + 99 others); Tue, 25 Oct 2022 10:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbiJYOOH (ORCPT ); Tue, 25 Oct 2022 10:14:07 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53319B87D; Tue, 25 Oct 2022 07:14:05 -0700 (PDT) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 5343E40737B7; Tue, 25 Oct 2022 14:14:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 5343E40737B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1666707244; bh=HI18v3+f+Pl+YyhFoHiqU9HpwMvARvOP6MXeGpCdq1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4Rw76ioj0sV5FcOz4mFluQTJQFBRHderUB+3PtsfLmRUHykCd4zoE9DfD/zWpjE3 ZOD/8mpLuAe1pKFxE3UIxKT2VlzdDmT5d8b6HLPV0CStVtl8WyzdGzze4zFxXDCdTk 4TQzY3EtG8UnXVDdOWdsLI/Nr/0hBx406Ov2CwVA= From: Evgeniy Baskov To: Ard Biesheuvel Cc: Evgeniy Baskov , Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , Peter Jones , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v2 17/23] x86/boot: Reduce size of the DOS stub Date: Tue, 25 Oct 2022 17:12:55 +0300 Message-Id: <2edb38e355437b1946e7fedcd4f5b4857a24be84.1666705333.git.baskov@ispras.ru> X-Mailer: git-send-email 2.37.4 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747669316582568792?= X-GMAIL-MSGID: =?utf-8?q?1747669316582568792?= This is required to fit more sections in PE section tables, since its size is restricted by zero page located at specific offset after the PE header. Signed-off-by: Evgeniy Baskov --- arch/x86/boot/header.S | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index f912d7770130..e4de831b2f64 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -59,17 +59,16 @@ start2: cld movw $bugger_off_msg, %si + movw $bugger_off_msg_size, %cx msg_loop: lodsb - andb %al, %al - jz bs_die movb $0xe, %ah movw $7, %bx int $0x10 - jmp msg_loop + decw %cx + jnz msg_loop -bs_die: # Allow the user to press a key, then reboot xorw %ax, %ax int $0x16 @@ -89,10 +88,9 @@ bs_die: .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 + .ascii "Use a boot loader. " + .ascii "Press a key to reboot" + .set bugger_off_msg_size, . - bugger_off_msg #ifdef CONFIG_EFI_STUB pe_header: