From patchwork Fri Dec 9 15:36:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 31839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp850423wrr; Fri, 9 Dec 2022 07:49:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5olGwKCZzYLwK1haA4pGeouR0XHfUeapVzju3MBNXHD2Y5wt5E0Mhh+OESOSoz6/g12R3h X-Received: by 2002:aa7:dc13:0:b0:467:559e:530c with SMTP id b19-20020aa7dc13000000b00467559e530cmr5391725edu.18.1670600968198; Fri, 09 Dec 2022 07:49:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670600968; cv=pass; d=google.com; s=arc-20160816; b=xBW6xmWQXIlFOX8S+qz7PZSZgvDAGEvNTNa7b0CDqkV5kRymKNnkjEO9ZjAR/8f+2Z bkPX5ZwrVeRrZXwshxEi3+s7J2jWsxjAJon1a9nxP6xDL1VQ1KqbD9K0coUY1E6cJx1P KaauS+VZxovnDv3KGIYrP9ApWqt0P7Qj3OePyldtJiLCxvEZkoZJRBJarEFflBCzeXCY tPFdopsihdIYCMH408BIekdZs/purhY8Jcjd/yTisbbUEmdVScPcJ6dYdglHjwtYs9Mf GQG6XopdUu/DyfspxG6mwihpaoijC6dHXLvjVti0kZaYiPSTWjdrqoKlXFvehG6i5qnX uKYg== 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=yO1Bb8EkmaYNrUwXwWRdRFTo+nQ8wWUK08fUE02PIV8=; b=FJCVkh2uGWujrtmzbfjEfoPDEoHYVFSy88FIXgb2XM/jNrX5XFaPpl6TXf5mRsG6bS ONTz0RojNNLkE0cjD8zAMhiSHWSvQExVTnOlLBTxEJKnkuE5f5mN6ZUzfhtc0iqFt0vu O57ovhXJgkacFmgFvIlAMcGvh8iYjAWFymWyLeJX/k77p4oDk1d6uKAnHuFtRoq7Y9v/ RYAMzuRVXJ+71FBj3oW21iWDD6xoVgXVc6i1ArBfnYLtWCyuvZipejRF9vdIaagEpjHf ip27yeM0BuleUNxk/4BjsY9JpnoeGnLaOrBwcX2LeKZPKYNkYxiK8jcvRB8aHELkCFDs TroQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=g7pP+qd8; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ANdfiQgi; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a05640242cc00b0046b13b72f40si2119287edc.609.2022.12.09.07.49.04; Fri, 09 Dec 2022 07:49:28 -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=@oracle.com header.s=corp-2022-7-12 header.b=g7pP+qd8; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ANdfiQgi; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230319AbiLIPhs (ORCPT + 99 others); Fri, 9 Dec 2022 10:37:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbiLIPhh (ORCPT ); Fri, 9 Dec 2022 10:37:37 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3391012 for ; Fri, 9 Dec 2022 07:37:35 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B9ExSsD009234; Fri, 9 Dec 2022 15:37:14 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-2022-7-12; bh=yO1Bb8EkmaYNrUwXwWRdRFTo+nQ8wWUK08fUE02PIV8=; b=g7pP+qd8D9gbPLOcUA9eTBoYD5z9k1Bds2/Y7V7QpR9zvLU2YqNk9O7nI0HAkUUCqQzs JG268KsnAeni9CMCffElOJGnWDLqKLC+kpZT62/3v4TEAhmboTZcu43C5H5QfAiIjJCS v69nbbHzt5w9j44cckMvTrRGlWAXrjCaYe8Ea5R0tA0/W2fNWUgjDgV4GV3RLR0Z9win +pf/RCfl6om3zEc1mJ2JYNhKEFJH77tIyATxvw2W2BSA39+qIdVOLjG629T9FKkH56je ch0ug4Plajc8i+9H32ySVxnWebKxitU6T1f79GHArGpAB2Y2Izuz+AlfVrlO6C2AGhIy rA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3maudkdg0m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Dec 2022 15:37:14 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2B9EASNB006731; Fri, 9 Dec 2022 15:37:12 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2047.outbound.protection.outlook.com [104.47.57.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3maa81ggu1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Dec 2022 15:37:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sengmk9FmPMs5j3O25NjLZzyCDZ1R4VmGnJZZ5fa6Bu/PtmQwrZXfoScPCKydkQ86cbF6HUetCtcMLqVeqEPqODh2VS05ef7iypigzJs85GJ1rYJ9LvlM2sXgQizBX7FAp5nezXOq5/IjnySWr3fTbhDS3QPS8KgX84OfK2YgNHAbEoqpguykxRW8aJgrmkQF4CYkwmNMXFh4rp8daK/tz2RI05acoj+P+7lOqGM6yb/GqXD/QeuXztWajOM1mPtZCRj0VMDx9GMIeq7+12nO7xcE5tfnnUDKbqA4ybdsj0m/cSh5z+ILhjwShKwfnAGkdq6YIk0LaYR75Xh7bIsjQ== 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=yO1Bb8EkmaYNrUwXwWRdRFTo+nQ8wWUK08fUE02PIV8=; b=YoOBdlNSG94qa1ebJboz0Ok76baWX8/fhMHIwQXQQiwi/KO3xvOPesO2LlJVj8COw/vNX6wiA1yKa+9WMxHtBGl80YQIm0mrWOZL6cbB+LWLsvH1uIZjZT+tFN7htYJItl8MibObdfQYT70VLATuc8OBT7fRRvnoBOBhOx0Is0js8s50P8wJ5MrGJ4LUcAOuLJdiFSHnYC6U7MxJPCiK6NCnmeUsNIUQb3pStTT5WVObDwnEMN0uJerHyx5ODuAf0UIOiI82RhLZ+7v/KZynS0ILpKK03NCQHqYpmFBNAKCmgUpWkC7/ojbvAknBhY3fBZ8ZuqmUagdrQfaupn1grA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; 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=yO1Bb8EkmaYNrUwXwWRdRFTo+nQ8wWUK08fUE02PIV8=; b=ANdfiQgiwNGwoE4iY3/lUCL+Kom/0fDeksOfd9y9AcUcJuAgQFt2PdVq0zIlt0Xt3NUya4NDnlQ23/19Pu45D0yEWNfJ4jN/vrX7ysa24BIUIj5qeR4BTJTuXHh6LWiXiTTxwsLN2EFL1tCl8Ru98zdJvks91DvfyZK47VOSsxs= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by SA2PR10MB4666.namprd10.prod.outlook.com (2603:10b6:806:112::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Fri, 9 Dec 2022 15:37:10 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a%9]) with mapi id 15.20.5880.018; Fri, 9 Dec 2022 15:37:10 +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, david@redhat.com, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v15 2/7] crash: prototype change for crash_prepare_elf64_headers() Date: Fri, 9 Dec 2022 10:36:51 -0500 Message-Id: <20221209153656.3284-3-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221209153656.3284-1-eric.devolder@oracle.com> References: <20221209153656.3284-1-eric.devolder@oracle.com> X-ClientProxiedBy: SA9PR10CA0005.namprd10.prod.outlook.com (2603:10b6:806:a7::10) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|SA2PR10MB4666:EE_ X-MS-Office365-Filtering-Correlation-Id: cb520380-ac98-4b9d-1c40-08dad9fb3c7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GdGT+WobPAJJFkeZA+3qlAMUgyiRs0YyEIFrQ9zBs/Y9imGvAQYevTkQkEM7OfTb1OdnLbZbeeCnqw2+E/OG/pC5YW/m80/Pow1zL1SSI8Vs05obBOAWe/+rVVAGgYiTgOdBzO9rRhNb8fA4v0WnXJQYM7VB2vrVpRUzI+8XLuJtTgipk3WY4KwG4OIWvAZ2rFIdCHTuWVeqjxV+ADO0+2T/b/xsIcCuW6uklQOkIlSkIe15NY9Jf5SxGJo2wnIxoL+j6LUexKUMM93wxEEOAp8IZ3kNCUW8oZ9PdEQ7jnzZCILKQZTQW/hgAmeAcX11QhMehACIZEaqA9AgCHypTP28Z9D0Qecm+/HH2kGj5o1s/ZJuHCb/H79TFx3YWja7lGhElkqHVhorwFJuXlkK4Hr6AlTF66rnjuZ3yCOLCUy2DJJxNGG7ZcGqmlszdU8/VIoNNcUG6nL84fBCQCWv/qcU3bVqTSRMqZn837fnUnvbG1lqqmpqwf9Mcr6LdidI+QY8YqyAYeIzEBUDWpYacYdAlgjAD9ZoDlTEo5PYUrmnXhzTtcltFL7QpzlyvDCR44JEp5Xd3PyMVSp7dpUY9gBTEVSX+2KdP84OgHZfcT0d3Uts5rfxWrjfw0uHtsxlYDtGvdD9qB8PeNseavQA1w== 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:(13230022)(366004)(136003)(346002)(376002)(396003)(39860400002)(451199015)(107886003)(6486002)(66556008)(6512007)(6666004)(86362001)(66946007)(8676002)(478600001)(4326008)(26005)(316002)(66476007)(6506007)(2906002)(1076003)(2616005)(41300700001)(186003)(38100700002)(7416002)(8936002)(83380400001)(5660300002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4YAeUxyJHZ4DjD+947a3VY+Sm5Rc9vsL6o7IMUymn7FcZiBJh+6shiomKm+JEnZOeRx6VV3Au5DKc5Vf2ZGKdc3Rq40paHrKXCFFkMNW1HPEEYPKhH/cL4VC8iZ1lrVMyJzwyRQRy/ikNo3b3LwZGNwwXcNGVmFHJsLV5TXifwyqstnyK3E+eTEmeFgHqI/fUxjwvlQp0EFtT00E7Ive4DM9kOC+3C8kXVbbQHp9QZRcTTeSLCdxb6rkWyZCE5lU03lyG1fLzQOr6uBp6urORHrii2n2HBjTqzsTtGtn8qSJGAsXGlRUjhBNdKGsdMrgQYAYe82HVYcQVUv/jqb5OJrX+ZcIjxQ5NiadEKraW67ECJiptPAPwDZu+vgWU9FiWdN4pxdELI6QaAYuxaR0X91Hi55hoWeM73InK12YwUrNI1Z51xrD/uM9wBmM46Navwt9qUdK9FbyMInEKypA9quM4z9ewYhU/MTeUiXqQebO80RN1D+RBNnMJSl8vx3+nImOQnAR5pf0D14ufDQR5fP13qyTwyNBHxsj2mIMVX4KyavB0WtsP7e5/Ohga5ILRiUKQYQRU1w+6y/FLgUvPHx3vikbcA/f5BrIDReB46breiGGBMvZJ/YmR+8BgVmlwDyTsR6cJtBJJ/pf7iPoBY7HeoFVfSRIwAeCWBEASdZSFtqnoyKHR5VUS0tTdXE/tM/ZVJns8D8t9blOi/Wl3hA0rHYiNmRVZVE7WL7Je2MoO02SdV/VYuQehasaz9QdFLcRjx4jN8fX0Nu0TV4wRvBXdLdrPIcBLiujYhhyTrnvb2gxaUvfsUkOvPJp2R9o20EigsIKXNaeeJCMCSp+k6gSDH2DBcoZzliIvvN0iLcpxH/GP1I6o2xh46wPK7OXuarYKRi9KHQdpGJ7JqHx06VPGsaKfgzoTveh6hIcec0D/V78O7H0Ckpro9L1GoypMh3gmsC2xYkfsKmWbbRdQuNwQkf8G0zuiTEMITrLKulrFwQGAbSk35BZ57qqrQF0XvFiosSuBoXOGyXdggIkVMbfNP6pJw8+ylSNYNe2w/EwvXQ553l4n0c0nrBH1pC/041fUU2DPx+r9toU1AkBGHmFdflqbRw6WaCWijM8uLj6p7fk2ZrRDmebTVWoLe0fMtgBCZ2DJzCPjHroQWHbPwNnSv8IaQ4sh/uBqDpcOZH8DVK4zVnBaMsVvewvTBpsNcqwIiB9E+wDtJKIPq0GMx2g+tO0dkIKIO+xV/Ba8M//QjnxgfZMnsu1pp9wgxikXkibWvsYb/GYy+67bDjAp8XxA1jvBYweAloMoPanYh2OXQZ6VJm2ikblW/1wDtuB4KKNaAmyqpZ8cnX2y7QXFm34ACTJuEstEbiiFvbtonoEnmvazkUWeslPZPo1u3DJw9xkYlhGazbmVI9sh5L3mzYRF+jwhvYDqKAvh3/WrnX2OaS+hqj2zgcTX7A/Xk9aF1C7uASAk9LiTjxu5NvJH0LevwCV94TgYWoPlqaS2JX4MDI0k212BlaI18fArDZCmPeUdsVeBm49xxdW7GSc22sr6U4f9+rkkWK/hs6mLAnQjUiFO6vdZhKJiNgedQKMy9SlVTWTu2P8jORhmnTVNg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb520380-ac98-4b9d-1c40-08dad9fb3c7a X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2022 15:37:10.3031 (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: /+rIOzJQIcbsccTycOAYONuRbBajnGYjs79Ny7Q6Q2kx9okwj0PHZvaDYnGepVSgxxqyxR50MUFRyuQCuqr9CzHBca+DaVWixGee782xmn4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4666 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-09_08,2022-12-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212090066 X-Proofpoint-GUID: lGLKKh8MszDRzrsCY_bYSmD3Dajk3Hs7 X-Proofpoint-ORIG-GUID: lGLKKh8MszDRzrsCY_bYSmD3Dajk3Hs7 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1751752080741124792?= X-GMAIL-MSGID: =?utf-8?q?1751752080741124792?= From within crash_prepare_elf64_headers() there is a need to reference the struct kimage hotplug members. As such, this change passes the struct kimage as a parameter to the crash_prepare_elf64_headers(). The hotplug members are added in "crash: add generic infrastructure for crash hotplug support". This is preparation for later patch, no functionality change. Signed-off-by: Eric DeVolder Acked-by: Baoquan He Acked-by: David Hildenbrand --- arch/arm64/kernel/machine_kexec_file.c | 6 +++--- arch/powerpc/kexec/file_load_64.c | 2 +- arch/riscv/kernel/elf_kexec.c | 7 ++++--- arch/x86/kernel/crash.c | 2 +- include/linux/kexec.h | 7 +++++-- kernel/crash_core.c | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index a11a6e14ba89..2f7b773a83bb 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -39,7 +39,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) return kexec_image_post_load_cleanup_default(image); } -static int prepare_elf_headers(void **addr, unsigned long *sz) +static int prepare_elf_headers(struct kimage *image, void **addr, unsigned long *sz) { struct crash_mem *cmem; unsigned int nr_ranges; @@ -64,7 +64,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) } /* Exclude crashkernel region */ - ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); + ret = crash_exclude_mem_range(image, cmem, crashk_res.start, crashk_res.end); if (ret) goto out; @@ -74,7 +74,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) goto out; } - ret = crash_prepare_elf64_headers(cmem, true, addr, sz); + ret = crash_prepare_elf64_headers(image, cmem, true, addr, sz); out: kfree(cmem); diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 349a781cea0b..a0af9966a8f0 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -798,7 +798,7 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf) goto out; /* Setup elfcorehdr segment */ - ret = crash_prepare_elf64_headers(cmem, false, &headers, &headers_sz); + ret = crash_prepare_elf64_headers(image, cmem, false, &headers, &headers_sz); if (ret) { pr_err("Failed to prepare elf headers for the core\n"); goto out; diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index 0cb94992c15b..ffde73228108 100644 --- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -118,7 +118,8 @@ static int prepare_elf64_ram_headers_callback(struct resource *res, void *arg) return 0; } -static int prepare_elf_headers(void **addr, unsigned long *sz) +static int prepare_elf_headers(struct kimage *image, + void **addr, unsigned long *sz) { struct crash_mem *cmem; unsigned int nr_ranges; @@ -140,7 +141,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) /* Exclude crashkernel region */ ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); if (!ret) - ret = crash_prepare_elf64_headers(cmem, true, addr, sz); + ret = crash_prepare_elf64_headers(image, cmem, true, addr, sz); out: kfree(cmem); @@ -212,7 +213,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, /* Add elfcorehdr */ if (image->type == KEXEC_TYPE_CRASH) { - ret = prepare_elf_headers(&headers, &headers_sz); + ret = prepare_elf_headers(image, &headers, &headers_sz); if (ret) { pr_err("Preparing elf core header failed\n"); goto out; diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 9730c88530fc..9ceb93c176a6 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -265,7 +265,7 @@ static int prepare_elf_headers(struct kimage *image, void **addr, goto out; /* By default prepare 64bit headers */ - ret = crash_prepare_elf64_headers(cmem, IS_ENABLED(CONFIG_X86_64), addr, sz); + ret = crash_prepare_elf64_headers(image, cmem, IS_ENABLED(CONFIG_X86_64), addr, sz); out: vfree(cmem); diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 41a686996aaa..ebf46c3b8f8b 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -253,8 +253,11 @@ struct crash_mem { extern int crash_exclude_mem_range(struct crash_mem *mem, unsigned long long mstart, unsigned long long mend); -extern int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, - void **addr, unsigned long *sz); +extern int crash_prepare_elf64_headers(struct kimage *image, + struct crash_mem *mem, + int need_kernel_map, + void **addr, + unsigned long *sz); #ifndef arch_kexec_apply_relocations_add /* diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 46c160d14045..8c648fd5897a 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -315,8 +315,8 @@ static int __init parse_crashkernel_dummy(char *arg) } early_param("crashkernel", parse_crashkernel_dummy); -int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, - void **addr, unsigned long *sz) +int crash_prepare_elf64_headers(struct kimage *image, struct crash_mem *mem, + int need_kernel_map, void **addr, unsigned long *sz) { Elf64_Ehdr *ehdr; Elf64_Phdr *phdr;