Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2189368pxb; Wed, 9 Feb 2022 12:48:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+TpaotfHX45NYTp3/IFd+Pj5zbjEoay1T283CswEnjxcu8L4lRbIsgx+aslI9MDveUaiT X-Received: by 2002:a17:902:8204:: with SMTP id x4mr3996075pln.18.1644439713943; Wed, 09 Feb 2022 12:48:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644439713; cv=pass; d=google.com; s=arc-20160816; b=VTBicBw7VKC6RrquiSV7qvl0S/rosORg85ET5CeM126SszpF2ma9RNKfBUc6lMNrrr A10G3A/BXuavtpnS0umCvtuRomtNUG2I9IY0rwaG/z/wuaIA5EEILKXVD+mZIpDNewTo K0zpOljziqXMZhA/cdlmmwNzIvdiVSiFGNk88YASP2RDWI7slxmGuHItjSUmsTpHJNqh JwwkUnpzh+q3QYzx5FoZz4j/rmTdsqm1Gr6TcQd987WBzYG2h/lLh+bLaoy679WijWe1 HUaMS1ZVF7ZlwOmS525k33R7gd3gKUWf6NQuHx3zfraP4A0sbQJL8wWpUOCyUk/3rYgN ScVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=j0oWpMhrVtFGnGj0GqWGztVHMmb4qcECw6VUMycpGKI=; b=xIVYcUG+rguF6KVszGxLROcdAHag3lp4Vvq+puwJrvwh2Coi29IVBPTMJi3YeZtYuW uCZKa9C/MLSYX1OBbD8w51gMgY4gXHR0g5ulNoqymlmBpZ65yyuEscX6tQp7KDlCNW8m EKx8y6WD4l7gipRcBVka00iDesEokPs7jCCEkIBL0C9s5sdY0RD8wG5ZFsdmH3MIPpjL +GtZXKMpKf1/kcJmsPaHue9uLEIQInSh6uh27lMOoruGI0HpSrKH5Wfxagi6huTmHCQz iltkHMfP4pfUd6usfAEjV6YEv6hVe8hbgRuiIq1pE89pZYjV/ZIVdPli/q1qSJvBRYr5 9Q0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=0PRwB2ae; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="HD/BzDxi"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x190si138434pgd.158.2022.02.09.12.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 12:48:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=0PRwB2ae; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="HD/BzDxi"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3C1AE095C4E; Wed, 9 Feb 2022 12:12:27 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbiBIT7t (ORCPT + 99 others); Wed, 9 Feb 2022 14:59:49 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:53516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbiBIT7e (ORCPT ); Wed, 9 Feb 2022 14:59:34 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9EECE06C412 for ; Wed, 9 Feb 2022 11:59:26 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 219HAbE1027666; Wed, 9 Feb 2022 19:57:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=j0oWpMhrVtFGnGj0GqWGztVHMmb4qcECw6VUMycpGKI=; b=0PRwB2aeB39K5QSYTh213Xcp7F9mXk3ZJATETtGZOZ05yVn6e3mppss0oDPcUEOOPgpn L1CNSNPRA5VHsMPI1Lj3/ADSkNvrYRu7+YA1DL4aabGArTCtZlZ+dOm3SWXDAJKFijt/ Lu320Pa6E3lFH5v9KDDxKrxQgShAM3wZvS+bOXg7JUQEl6fx68xp9Xl2OkcoGkdnOSps la/mAjCQaL5D8wfSX8PTo4X+V6Fwc7uYr36dQDWXEvP47etSnX2UaHamITpi4Z/FX/3T N1LUY+AW34hawQfNjKtuMsC2GOeMSFLkP5Aaf0ARqtmdDpj+v847wXQad1RgD5Byn3Ra hw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e3hdswn35-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Feb 2022 19:57:41 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 219JtqrW046251; Wed, 9 Feb 2022 19:57:40 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by userp3030.oracle.com with ESMTP id 3e1ec3b0ku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Feb 2022 19:57:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBBEL/llaCZ0t62ylMzYgQY/A5AaqrWkFma+wQZgVLK6WktbHXbpeEGTQixu5ksd8XCoFk6o0EhD85orSD7UCGqHs+htztGhcASwAzAZde4vKSrqKasWfG48e1tJ1qgV+uGjKmlBdHzYbrDbwekUDgdxt/BgaBZydFoFPwu8JtmDCSonRdL8/sMqjK5gILrNZ5PtTNYPj9z5Ujavl5AuEtmpn2K/UAliFcgm08jitZRZYBATuoH6HbyiwJG4UfSSD8nG16CdAayt6lckNIyBwo1KLR4rK2sl4bRy02hM996K5g0aqQQrZvJQhf4qE1cNYAN6UOrrIJ653/Xz/BYbDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=j0oWpMhrVtFGnGj0GqWGztVHMmb4qcECw6VUMycpGKI=; b=cXKr2jVX9Mlq9+AkoWBqHerMgor1I4vn9Q3bf+UnPshUBv74Qqyog+raIzEu7VAhpA1YzISO1orB/Elm8Rd9JHoPgd0By3AJHLlw6ii1hpDkBcLtcgA5Nx396sKxrC8BypQ+ldYzQCBKQkZOrajHV/1NW5SR0hmyDFl2FcogQJ5IW0NGAlnl8oRsWpbQSQ0KQukH2iRsPnqo87sZYtrUi3JQTxs8rBolK2A1CP8OjqxgthbUSpBy6rQdDLHjbmOn/3l65gJVxfxpglOhgXNEtm8mn9QDGWvhAmeLsmmC+p0vUw46bfxkmJpIMEWINHSnEHHIFIjSx8JNKzKN+jKeKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j0oWpMhrVtFGnGj0GqWGztVHMmb4qcECw6VUMycpGKI=; b=HD/BzDxiTi1SGQL/kUNjoZMszVHiFCSN8CeVM3l3W9Zuqxj6HhfvgLr2ZlgC9EqJ2u1rFEqXwhrn7b2MyYk3+wZGY5kW7TCT6VRjaGUGZpWMe2CLPjBwz1ncAsH04XKyetNffIzg9Gv5w/NB231XDPKEMM9Ssqi8kK+AhC/y5Bs= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 9 Feb 2022 19:57:36 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::ac06:be4:5723:771c]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::ac06:be4:5723:771c%5]) with mapi id 15.20.4975.011; Wed, 9 Feb 2022 19:57:36 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, ebiederm@xmission.com, dyoung@redhat.com, bhe@redhat.com, vgoyal@redhat.com Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, nramas@linux.microsoft.com, thomas.lendacky@amd.com, robh@kernel.org, efault@gmx.de, rppt@kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v4 07/10] crash hp: exclude elfcorehdr from the segment digest Date: Wed, 9 Feb 2022 14:57:03 -0500 Message-Id: <20220209195706.51522-8-eric.devolder@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220209195706.51522-1-eric.devolder@oracle.com> References: <20220209195706.51522-1-eric.devolder@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM6PR05CA0046.namprd05.prod.outlook.com (2603:10b6:5:335::15) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7775026-4561-4885-8d63-08d9ec066b01 X-MS-TrafficTypeDiagnostic: MW4PR10MB5701:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l23Opjep0BH4DUoBbQw8O4G0ZoKa6ciECvY2UYRTApvb9EK0TnKmShnln7hEQf6+Xh7Acw3gvHCBYDgcm/C2sQT1JYjpESmx2g+4rdEaHzMjmnyPLJ1q6tI/pJBGaVoX0fgI2Q/m9rpIGMQdbkOew45iGtuP9AUYjmax9K7wE1HNqlvJwccqxijPRO4LMx2sLCsB1qcL8uK0yOaGKlF5bZPvuK3JTkf7oytrkXLfAfJBgusOK4ZArMYpEHWfkvlqgA3E3fxYlKUJVStlATwxRpCN53wVvhhLLEH19i/kvOWUTQPlAlT3aaKFbFSeYme5eLRDjjvE4lZR7Ib1YUnBQ41uE+KZ3BmMnRJ3sDsxiNIj8ydczi7ozYiMwNg0Xyied9JpoJfZtcglU8SlBE002eYi60MoeDzYAQbDWBBIoDBM0WPhwSjE4D92+t71rlRyPQFl4M26TBwkIaDwK9mgZ3d1WOlTrg4uAOpHOFTAZaWV3gtnNQnTJa4EhIkCEIAOa4pTqFvc8QJYYlsuCKzmQayoFJlFU8lshvzL3gmM62eLm6AKriZBcWNpICpesiuWWJXRj2kd7CoRw1Uh3vify0ZIX2MGGDM1bBtN9H6jWvXkASDHKWVy+y7zmZWVZJwE9OJl9k135hH8e8SdDk1Y8JM2nSV9M5IeOYNuj71lIY/OflSM7GHJYi3+kwQ/Yt7gp/O/c0rBjtCvqx1sCTurRA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4531.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(36756003)(7416002)(5660300002)(1076003)(26005)(107886003)(2616005)(186003)(38100700002)(2906002)(38350700002)(8676002)(86362001)(316002)(6486002)(508600001)(6666004)(6512007)(52116002)(6506007)(8936002)(4326008)(66946007)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8FU3cwS7cND82R/3Iduio1YGGOiVOc+fJeokujEHFrKRu3ZaAa+JGi6jBLET?= =?us-ascii?Q?1jPbW77+d77aSJ+BgyrZ+uNPob7vDW2gjGVLWKhAbAI0EVadngLyA8TvS9iv?= =?us-ascii?Q?PB4sym3gsoioDGbcpxVFGCMffqTIXctkKMQblr0aoWK+nT9gyzadaUhIQwe+?= =?us-ascii?Q?zTSAfeT2kzeI1jgqmIlYlfFlf5BcGY9G3JYYSx2JMzrR1SnMbs1IwW04URLL?= =?us-ascii?Q?PhUxWzoCC864Sej2xB7NHeOAXcZ/CqkR0qkYb2xYYqyMcUnjSvBGBsUTP7P5?= =?us-ascii?Q?bQhBoTGTB9FgpQPurb5YXmFS42LWc8wAz/jtzn0bqRhzeIt2dX8Q7/gR31Qy?= =?us-ascii?Q?OTlJgWOa5gisrAYwAU1HJl7AoW5QOERVpA94N99PwgYKFPLOZHh0QQ5+sOIF?= =?us-ascii?Q?Ln0Xa8aFfgWH2oMeDDgbdtQgj3LiVkB3G0II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-ascii?Q?t8E63HBKZtYtWEVJUv3Mv0Aumto1KoJuuwYhdD/yfe7dtAF3YGQ2S9RsOFjx?= =?us-ascii?Q?aiVI8M3qr7SErSz9L9kdBewFMkIbd8UsDD+oAhrBb8/n9LdtPHf4UiCsxzFq?= =?us-ascii?Q?YUSZBPOjNQnzU011KkqnY/Be/MtMmOtJVZD/mEbWLlX/UAQmsvGQLwW4/YJ6?= =?us-ascii?Q?oAzLri0ITJvl3gsHuqOqBEygY3UV0dzIlPP3noCxUW35NhNNX012yiORhMGI?= =?us-ascii?Q?0B0tTCTMv1GOz2Q7W43HZUWrmaipUKj4saeuBCz7sVXS24sy6KXwvMW5mtFo?= =?us-ascii?Q?r6epQe0hWRwWOngsxAnegqaPzToLrMjmyH60wYp9TyrPbqfW3WR2vmdO+Y9b?= =?us-ascii?Q?hlSw8A=3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7775026-4561-4885-8d63-08d9ec066b01 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2022 19:57:36.0108 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3Di9Mjy3eKHHwvuGinuyYw6RmLALWWdYXrdLKZD0gjQpBzh4InV/cno/xLDBXpehl5q79nYCcyqeZmicfXRLEcjvp2pSOZ7BrGlG9JuYmPE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10253 signatures=673431 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202090106 X-Proofpoint-GUID: qj4BcoWoCvivL2DepstKwDiAoevd_BNY X-Proofpoint-ORIG-GUID: qj4BcoWoCvivL2DepstKwDiAoevd_BNY X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 When a crash kernel is loaded via the kexec_file_load syscall, the kernel places the various segments (ie crash kernel, crash initrd, boot_params, elfcorehdr, purgatory, etc) in memory. For those architectures that utilize purgatory, a hash digest of the segments is calculated for integrity checking. This digest is embedded into the purgatory image prior to placing purgatory in memory. Since hotplug events cause changes to the elfcorehdr, purgatory integrity checking fails (at crash time, and no kdump created). As a result, this change explicitly excludes the elfcorehdr segment from the list of segments used to create the digest. By doing so, this permits changes to the elfcorehdr in response to hotplug events, without having to also reload purgatory due to the change to the digest. Signed-off-by: Eric DeVolder --- kernel/kexec_file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 801d0d0a5012..93bb0c0ce66c 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -765,6 +765,12 @@ static int kexec_calculate_store_digests(struct kimage *image) for (j = i = 0; i < image->nr_segments; i++) { struct kexec_segment *ksegment; +#ifdef CONFIG_CRASH_HOTPLUG + /* This segment excluded to allow future changes via hotplug */ + if (image->elf_index_valid && (j == image->elf_index)) + continue; +#endif + ksegment = &image->segment[i]; /* * Skip purgatory as it will be modified once we put digest -- 2.27.0