Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp748118pxu; Wed, 14 Oct 2020 12:39:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4MfliZ6zI2uqHjTxcNfBC6NWM62brboTVeo+UHkRzdVDga8BPBCGANdC1+hGqTDk3MBNu X-Received: by 2002:a50:8acf:: with SMTP id k15mr530272edk.351.1602704343263; Wed, 14 Oct 2020 12:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602704343; cv=none; d=google.com; s=arc-20160816; b=oIKmwh/instt8abQb0R/rJDfG8rIv9rpMWVGzzK+/hRKQV3pDiCcX584S2iSEe1wxd fd7SLf8mfapPSUp7KF86/tvLTR38hZe5qSxT+rRy2tblDlx13a0U9vtOPXb0fSwz+Wfk et1gxppL0wT8esCwj2C0Oq4zJURWddFGrmoGkMR4ZUuY8kEyKvLUBrusEmbV8vEWdUxm QJJNIa9L1qVHxqcpQX4zluQiY+20LSPnCmZ18JDjJGT7gQmbqHZXzcUB3vhdMQeTnJD3 RF7LS9AYMUrK2N3We3VJ6CQzxeuBUhr3FETJEzrcUN6G6ACuEpJoo9UCrCjVU7PEdy/N +oxA== 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; bh=AF5EHyVWVFXLN/yYF6ryGSvyFHTXybRiC8wgcAhI7fM=; b=EYDcuqx5/rehsNrpQnmt9KmQEgomoz66iCMJlnWRDzvYtl/m8XtemUc9HUDmN7eUr/ yhD6nnkU5pkm4+Ht5GHjlJ7yUEitkR6/0YATQZH8uK08eBOh0vqv8gF9EbI++M1nW4Kc 5/ABRbGxV3wUEY6RXIj6PipXgSD1yxb0P891/OSZnUl6KVy/5NadMQbYhR4J2dFJlaCP WUW6VWWh46VVclxQUMVgW8kPr0vMrkluavvOwAy0w1GMUzt0Up3LbdIv8HaaJZxg0X5W o5kW6cqSQezM9CLDoFdzyYWZ0/LcAAZSFnGqrX+60KgkCGa4jM+vj/x+eJa6vH+Zh3xE pc3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AktYIYfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si341755edr.349.2020.10.14.12.38.28; Wed, 14 Oct 2020 12:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AktYIYfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728794AbgJNJ0W (ORCPT + 99 others); Wed, 14 Oct 2020 05:26:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38721 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730188AbgJNJZq (ORCPT ); Wed, 14 Oct 2020 05:25:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602667545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AF5EHyVWVFXLN/yYF6ryGSvyFHTXybRiC8wgcAhI7fM=; b=AktYIYfZHXBnW+ChZuC0cLlYCfA8EOBKde5IMP2SN3aTzq+o/RieFQkdbnyVSN14qFuo13 /OpaA/8tcUrjM7yay4QNULwM1CMQeWtn6EPblyd/6KNidC60amvqA8ZCnogpQofOPB1j83 d0IMWXbzU4EHvXZjXqU1yAf4qo3Eydo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-jT22B8ypPYWoRId9bd6cqQ-1; Wed, 14 Oct 2020 05:25:41 -0400 X-MC-Unique: jT22B8ypPYWoRId9bd6cqQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0A7E518A8221; Wed, 14 Oct 2020 09:25:40 +0000 (UTC) Received: from kasong-rh-laptop.redhat.com (ovpn-12-25.pek2.redhat.com [10.72.12.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B7525C1BD; Wed, 14 Oct 2020 09:25:30 +0000 (UTC) From: Kairui Song To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Ard Biesheuvel , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bartlomiej Zolnierkiewicz , Dave Young , x86@kernel.org, linux-hyperv@vger.kernel.org, kexec@lists.infradead.org, Kairui Song Subject: [PATCH 1/2] x86/kexec: Use up-to-dated screen_info copy to fill boot params Date: Wed, 14 Oct 2020 17:24:28 +0800 Message-Id: <20201014092429.1415040-2-kasong@redhat.com> In-Reply-To: <20201014092429.1415040-1-kasong@redhat.com> References: <20201014092429.1415040-1-kasong@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kexec_file_load now just reuse the old boot_params.screen_info. But if drivers have change the hardware state, boot_param.screen_info could contain invalid info. For example, the video type might be no longer VGA, or frame buffer address changed. If kexec kernel keep using the old screen_info, kexec'ed kernel may attempt to write to an invalid framebuffer memory region. There are two screen_info globally available, boot_params.screen_info and screen_info. Later one is a copy, and could be updated by drivers. So let kexec_file_load use the updated copy. Signed-off-by: Kairui Song --- arch/x86/kernel/kexec-bzimage64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 57c2ecf43134..ce831f9448e7 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -200,8 +200,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch; /* Copying screen_info will do? */ - memcpy(¶ms->screen_info, &boot_params.screen_info, - sizeof(struct screen_info)); + memcpy(¶ms->screen_info, &screen_info, sizeof(struct screen_info)); /* Fill in memsize later */ params->screen_info.ext_mem_k = 0; -- 2.28.0