From patchwork Wed Feb 23 11:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 12756767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B5FC433EF for ; Wed, 23 Feb 2022 11:32:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F1218D0003; Wed, 23 Feb 2022 06:32:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 49FAF8D0001; Wed, 23 Feb 2022 06:32:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3671D8D0003; Wed, 23 Feb 2022 06:32:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 276E28D0001 for ; Wed, 23 Feb 2022 06:32:54 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DA2A1181CE2A2 for ; Wed, 23 Feb 2022 11:32:53 +0000 (UTC) X-FDA: 79173832626.12.2AE273C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 1FC9A40004 for ; Wed, 23 Feb 2022 11:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645615972; 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; bh=9zlGa6br0c39oKdANUse/M0gLmRqJHCFXxLHhx7TVM4=; b=aaNKrJgUvZdmoXt2MoHpO/Ru15BPLY8hdmLvqI3QB5lvRV0kFB/pg5Lze8DQnfjLxD+tFE x7RmL4yw6mRccrj/XqFOM47bSK0rpbo7TgFz7FD4oO4iSwxEmCpe9zniY/UH0C2F8rUzb5 GAPiguKnIyh+pdcuas/ni8bZ1gzTZvg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-515-CNeKcLYINQq7yFV3u3g-Ew-1; Wed, 23 Feb 2022 06:32:49 -0500 X-MC-Unique: CNeKcLYINQq7yFV3u3g-Ew-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1773D1091DA2; Wed, 23 Feb 2022 11:32:48 +0000 (UTC) Received: from MiWiFi-R3L-srv.smartont.net (ovpn-13-167.pek2.redhat.com [10.72.13.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78D54797CE; Wed, 23 Feb 2022 11:32:35 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, dyoung@redhat.com, akpm@linux-foundation.org, bhe@redhat.com, x86@kernel.org, linux-mm@kvack.org Subject: [PATCH v2 0/2] x86/kexec: fix memory leak of elf header buffer Date: Wed, 23 Feb 2022 19:32:23 +0800 Message-Id: <20220223113225.63106-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Rspamd-Queue-Id: 1FC9A40004 X-Stat-Signature: pzqt394bjj4rxp9f3k45yei5ynur91nb Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aaNKrJgU; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1645615972-544333 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The memory leak is reported by kmemleak detector, has been existing for very long time. It casue much memory loss on large machine with huge memory hotplug which will trigger kdump kernel reloading many times, with kexec_file_load interface. And in patch 2, clean up is done to remove unneeded arch_kexec_kernel_image_load() and rename functions. V1 post can be found here: https://lore.kernel.org/all/20211029072424.9109-1-bhe@redhat.com/T/#u v1->v2: No code change. The v1 post has been acked by Dave Young but not merged. In v2, just merging the old patch 1 and 2 as per Dave's concern in v1 post. Baoquan He (2): x86/kexec: fix memory leak of elf header buffer kexec_file: clean up arch_kexec_kernel_image_load arch/x86/kernel/machine_kexec_64.c | 23 +++++++++-------------- include/linux/kexec.h | 1 - kernel/kexec_file.c | 9 ++------- 3 files changed, 11 insertions(+), 22 deletions(-)