From patchwork Tue Nov 22 11:12:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeniy Baskov X-Patchwork-Id: 24287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2139473wrr; Tue, 22 Nov 2022 03:19:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf6rDcDhwe8w+1pW3Tyuaflk/7jlgbyZ40zfb6dJmV7iWQoX0CqnjMnU1yIJYvE4MBOpTrgs X-Received: by 2002:a17:906:b2c6:b0:78d:20f7:1294 with SMTP id cf6-20020a170906b2c600b0078d20f71294mr20109795ejb.442.1669115972202; Tue, 22 Nov 2022 03:19:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669115972; cv=none; d=google.com; s=arc-20160816; b=nlz4PB2P9brds+QvTu5YV1y31hQouIrM699UPbMIclDLl7APhJ801I/7k+jiyTZkbF srfw016hPO2pfVPtiPCOPc5l1djYeVjG0CP0Kk3dnaN1n36fLvuCpuXiuxZQ6ucHpSky i6ELybPljCvgQwgMvV9Xm9ErqYghQ0Bt2XccB4kR/AmVCKhNHWZoi3F436h7aw7utCB1 xeF1db/BTHn47Vf3KKbzrwYKDeTWsS/jk90VSYew5T5BTxDG3SG8xHVngIxLcT0lLg6o lB2U04z2JEyjNlh2QIpHFcQ7e0KyGCf7umBTZWf1AylfeHbojt9GHy6jEx25NCOaSUBv SxAg== 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=ECseb6siPLZccH2FNtVbbnERJUQobRq291fpKz8aIww=; b=0G3g4/xjhjcXeAV30IQbW7pzS+IUHuESVAP9hHdFhgpj9ynDzPo5mvVr4UCUR+QKo5 1G/YAcySqc0CsQdwNoBHHFSy6KSbHLJ8qdVgUVnd6b8nKNqheHQ//Kx6xnU6YROx3cf1 /j5jXT2J3aLozr1SxxuG+S1hzrlMmNWLt9b8lkOTH0B7nwxjzuoWszrFVjRaD7OfasMt fS+S5xZqQcZTmFRNOmSw3vIOERPZggfzHqUsMkHsCK7cDbhzLGBJH/iLyu79rsMdwoQ5 Js+PTFyDiMb+V3lAOUFBpdnZ2opFO9gx5+8Xd3q2UAa4vbpb/ponE/ICiTVGvKdSWQrI dgqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=VPiJwsYd; 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 m20-20020a056402511400b0045caa1628c6si12767904edd.216.2022.11.22.03.19.08; Tue, 22 Nov 2022 03:19:32 -0800 (PST) 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=VPiJwsYd; 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 S233285AbiKVLSq (ORCPT + 99 others); Tue, 22 Nov 2022 06:18:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbiKVLRc (ORCPT ); Tue, 22 Nov 2022 06:17:32 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD994E094; Tue, 22 Nov 2022 03:14:46 -0800 (PST) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id DDAB640737BC; Tue, 22 Nov 2022 11:14:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru DDAB640737BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1669115685; bh=ECseb6siPLZccH2FNtVbbnERJUQobRq291fpKz8aIww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPiJwsYdfgZtNzI/9Q3y26cnwCKwOz8T5jNsOKhxqG+V8x4LYrDU0adtar4OlsOgy qRD5XGs0+z9uv6irj0VH1T6YWpybVM3LpujcnTpu9536RR6LfSdSJG5SMCNkTl2MP3 EEXskEdyftMKZmSQZKHsKg6uYn0VPF+yQTVlZ6no= 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 , "Limonciello, Mario" , joeyli , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v3 17/24] x86/boot: Reduce size of the DOS stub Date: Tue, 22 Nov 2022 14:12:26 +0300 Message-Id: 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 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?1750194949728656201?= X-GMAIL-MSGID: =?utf-8?q?1750194949728656201?= 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. Tested-by: Mario Limonciello 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: