From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E782C433DF for ; Wed, 14 Oct 2020 15:43:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEE3F2222E for ; Wed, 14 Oct 2020 15:43:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="L+P5J8Gx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lrCc6r0Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730493AbgJNPnX (ORCPT ); Wed, 14 Oct 2020 11:43:23 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59468 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729881AbgJNPnX (ORCPT ); Wed, 14 Oct 2020 11:43:23 -0400 Date: Wed, 14 Oct 2020 15:43:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602690201; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fdwtKkZDdyzWvKjhd4L8ijmt3BqvbwVLIQ5uAEObevk=; b=L+P5J8Gx5l+eF0NXLI8AGT/5xEEuS99C89+TRuXr81OQIks5j08MjknWmZlv9vVFJ6bgOt IvEI8vRtjmCktMKUjecFqoyG0V9Bk4lITHX6qSYsUDNds/e8xMaJ5GPdw9Brx7Lm1fD86Q q1QjDi/LyWLTTxOsBwq9pK0WT7w1Cst78xyppGewuWpJHEQr+Kkj6M0jEgXaf2qCW3HVvg TaMLG7/qgWP4FlAPpH7x1BPIVgLE39+MOOdK8BUl9p7o5d98D6S1o+aTORQb28UqPRNOae QAVPh+TOXxIOw/rN2iU85TTg+k8xBuu4/UfmeH9MYVtCpi5V2fEAZWZrLIlpTw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602690201; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fdwtKkZDdyzWvKjhd4L8ijmt3BqvbwVLIQ5uAEObevk=; b=lrCc6r0ZWGMenJp6cMY9fHE7Wbwc6dcNwIY0H7BhmpU3snIq5SO+qEw0mYQHmYWE3uaE9L k7W7FvR/TBlSvIBA== From: "tip-bot2 for Kairui Song" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/kexec: Use up-to-dated screen_info copy to fill boot params Cc: Kairui Song , Ingo Molnar , x86 , LKML In-Reply-To: <20201014092429.1415040-2-kasong@redhat.com> References: <20201014092429.1415040-2-kasong@redhat.com> MIME-Version: 1.0 Message-ID: <160269020077.7002.6607120194042289745.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: afc18069a2cb7ead5f86623a5f3d4ad6e21f940d Gitweb: https://git.kernel.org/tip/afc18069a2cb7ead5f86623a5f3d4ad6e21f940d Author: Kairui Song AuthorDate: Wed, 14 Oct 2020 17:24:28 +08:00 Committer: Ingo Molnar CommitterDate: Wed, 14 Oct 2020 17:05:03 +02:00 x86/kexec: Use up-to-dated screen_info copy to fill boot params kexec_file_load() currently reuses 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 the frame buffer address might be changed. If the kexec kernel keeps using the old screen_info, kexec'ed kernel may attempt to write to an invalid framebuffer memory region. There are two screen_info instances globally available, boot_params.screen_info and screen_info. Later one is a copy, and is updated by drivers. So let kexec_file_load use the updated copy. [ mingo: Tidied up the changelog. ] Signed-off-by: Kairui Song Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20201014092429.1415040-2-kasong@redhat.com --- 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 57c2ecf..ce831f9 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;