Message ID | 20231123073652.507034-2-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp277139vqx; Wed, 22 Nov 2023 23:37:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8uq1iIujz5Syo3h3bl+MUtqUMgR7acHjtIbsX43NgyvzeAnFuWUyUFsF6MN678jMzpx0c X-Received: by 2002:a17:90b:1b03:b0:280:23e1:e4dd with SMTP id nu3-20020a17090b1b0300b0028023e1e4ddmr2571003pjb.17.1700725037910; Wed, 22 Nov 2023 23:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700725037; cv=none; d=google.com; s=arc-20160816; b=nUtU2E5Jz1NCJh6H1vGJsVLhYhELnGB4Nw5UOTRq8pBCI4ujLRt/M0ophoJEUR4S4w xbeQOmrg1WFTO51b6yjz5yVUlIFwWBTI2a22Pxl84b/xlkUAQvNPv5ycCkvUnuKCBs5I 0kx4GGc8ss1SOwHSNu1CTO6YRyneUjlM5WR5HNr2z2Q8eO4NtB0yooMiJcGdCs5K/K48 Tnn9mnv4eY1hrt9L7FDaMhcaEO0s18sXeQZ/+pj9IudqlL0jLqhKljQ0eXddZXQhEgTX JRMSpUlGhf9DeH/UT6rtYPTrFxQ5hkrPoLj9X/swUTkBC1x1ALcBT4xkZ33vBLbQUs2X mwcw== 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=sXRKoO9zAkgm8b+Bxr4SCC+gEy3bcdHacUdRqCwlROA=; fh=vL7x4bgFLl4JXLQ25ukDrYi2Fznm1zAkzIBXuJ1+XwQ=; b=N424jHESnSHwpshvRx/sZgJrykHFYw2/G6dwSX+DWigO54PHlq/vlWYFvgVOeNooSe p6Y6gqY8cx+y9Qj0LCiyaZcxIXLgWbcBQbhNhpasW+gGkOtNvBFa+YTLwxpZXiwW0d1M EGf+byU2NFC6UaTC/+UyAAEz2HzuZ9srP7cdaQ3zSnTNmnGAVLZkhtRceDKl6BSk88dN U99yQntxpRdwy/HPwyyJSYjOrXz31aajYLoooa7Am9ahvC+BduYURayrlDVflDY3NVlz bka/3kEvlsuFZTQt6aGniKsswoHgmsmWizly/r7S8+5p/8Mw4QpOZsuQcSDVIRqgk+HT uq9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hzPaCQ5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s13-20020a17090ad48d00b002850da514f1si1217642pju.181.2023.11.22.23.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hzPaCQ5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2E48A825026C; Wed, 22 Nov 2023 23:37:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344879AbjKWHhD (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 02:37:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjKWHhA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 02:37:00 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59E89E7 for <linux-kernel@vger.kernel.org>; Wed, 22 Nov 2023 23:37:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700725026; h=from:from: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=sXRKoO9zAkgm8b+Bxr4SCC+gEy3bcdHacUdRqCwlROA=; b=hzPaCQ5m+c2WSBW2op7RVgyGbknmBDyKSa6a2u/OKJn+cFLnxM1AvsbwSmdP65kFsVKw7R RBKOVzZ81Qxmx0vm5RolW2svqihBQVo3z6MLH+kBwNtL34ims0xCVurapMlwAdXEsAkt4g 5eFZl4QtzkuD6TCwJ/F07aCDpZ9Gwfo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-25x3cXZyO_GiQ874kgA9UQ-1; Thu, 23 Nov 2023 02:37:03 -0500 X-MC-Unique: 25x3cXZyO_GiQ874kgA9UQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A890F82DFE8; Thu, 23 Nov 2023 07:37:02 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 893CA492BFA; Thu, 23 Nov 2023 07:36:59 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, akpm@linux-foundation.org, ignat@cloudflare.com, eric_devolder@yahoo.com, Baoquan He <bhe@redhat.com> Subject: [PATCH 1/3] kernel/Kconfig.kexec: drop select of KEXEC for CRASH_DUMP Date: Thu, 23 Nov 2023 15:36:50 +0800 Message-ID: <20231123073652.507034-2-bhe@redhat.com> In-Reply-To: <20231123073652.507034-1-bhe@redhat.com> References: <20231123073652.507034-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 23:37:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783339450528182070 X-GMAIL-MSGID: 1783339457107842173 |
Series |
kernel/Kconfig.kexec: drop select of KEXEC for CRASH_DUMP
|
|
Commit Message
Baoquan He
Nov. 23, 2023, 7:36 a.m. UTC
Ignat Korchagin complained that a potential config regression was
introduced by commit 89cde455915f ("kexec: consolidate kexec and
crash options into kernel/Kconfig.kexec"). Before the commit,
CONFIG_CRASH_DUMP has no dependency on CONFIG_KEXEC. After the commit,
CRASH_DUMP selects KEXEC. That enforces system to have CONFIG_KEXEC=y
as long as CONFIG_CRASH_DUMP=Y which people may not want.
In Ignat's case, he sets CONFIG_CRASH_DUMP=y, CONFIG_KEXEC_FILE=y and
CONFIG_KEXEC=n because kexec_load interface could have security issue if
kernel/initrd has no chance to be signed and verified.
CRASH_DUMP has select of KEXEC because Eric, author of above commit,
met a LKP report of build failure when posting patch of earlier version.
Please see below link to get detail of the LKP report:
https://lore.kernel.org/all/3e8eecd1-a277-2cfb-690e-5de2eb7b988e@oracle.com/T/#u
In fact, that LKP report is triggered because arm's <asm/kexec.h> is
wrapped in CONFIG_KEXEC ifdeffery scope. That is wrong. CONFIG_KEXEC
controls the enabling/disabling of kexec_load interface, but not kexec
feature. Removing the wrongly added CONFIG_KEXEC ifdeffery scope in
<asm/kexec.h> of arm allows us to drop the select KEXEC for CRASH_DUMP.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
arch/arm/include/asm/kexec.h | 4 ----
kernel/Kconfig.kexec | 1 -
2 files changed, 5 deletions(-)
Comments
On Thu, Nov 23, 2023 at 7:37 AM Baoquan He <bhe@redhat.com> wrote: > > Ignat Korchagin complained that a potential config regression was > introduced by commit 89cde455915f ("kexec: consolidate kexec and > crash options into kernel/Kconfig.kexec"). Before the commit, > CONFIG_CRASH_DUMP has no dependency on CONFIG_KEXEC. After the commit, > CRASH_DUMP selects KEXEC. That enforces system to have CONFIG_KEXEC=y > as long as CONFIG_CRASH_DUMP=Y which people may not want. > > In Ignat's case, he sets CONFIG_CRASH_DUMP=y, CONFIG_KEXEC_FILE=y and > CONFIG_KEXEC=n because kexec_load interface could have security issue if > kernel/initrd has no chance to be signed and verified. > > CRASH_DUMP has select of KEXEC because Eric, author of above commit, > met a LKP report of build failure when posting patch of earlier version. > Please see below link to get detail of the LKP report: > > https://lore.kernel.org/all/3e8eecd1-a277-2cfb-690e-5de2eb7b988e@oracle.com/T/#u > > In fact, that LKP report is triggered because arm's <asm/kexec.h> is > wrapped in CONFIG_KEXEC ifdeffery scope. That is wrong. CONFIG_KEXEC > controls the enabling/disabling of kexec_load interface, but not kexec > feature. Removing the wrongly added CONFIG_KEXEC ifdeffery scope in > <asm/kexec.h> of arm allows us to drop the select KEXEC for CRASH_DUMP. Hm... With the patch, when cross compiling for arm and CONFIG_KEXEC_CORE=y # CONFIG_KEXEC is not set CONFIG_CRASH_DUMP=y I get the following linker error at the end: CALL scripts/checksyscalls.sh UPD include/generated/utsversion.h CC init/version-timestamp.o LD .tmp_vmlinux.kallsyms1 arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `kimage_free': kexec_core.c:(.text+0xf5c): undefined reference to `machine_kexec_cleanup' arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `__crash_kexec': kexec_core.c:(.text+0x15bc): undefined reference to `machine_crash_shutdown' arm-linux-gnueabi-ld: kexec_core.c:(.text+0x15c4): undefined reference to `machine_kexec' arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `kernel_kexec': kexec_core.c:(.text+0x1a04): undefined reference to `machine_kexec' make[2]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 1 make[1]: *** [/home/ignat/git/linux-upstream/Makefile:1154: vmlinux] Error 2 make: *** [Makefile:234: __sub-make] Error 2 > Signed-off-by: Baoquan He <bhe@redhat.com> > --- > arch/arm/include/asm/kexec.h | 4 ---- > kernel/Kconfig.kexec | 1 - > 2 files changed, 5 deletions(-) > > diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h > index e62832dcba76..a8287e7ab9d4 100644 > --- a/arch/arm/include/asm/kexec.h > +++ b/arch/arm/include/asm/kexec.h > @@ -2,8 +2,6 @@ > #ifndef _ARM_KEXEC_H > #define _ARM_KEXEC_H > > -#ifdef CONFIG_KEXEC > - > /* Maximum physical address we can use pages from */ > #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) > /* Maximum address we can reach in physical address mode */ > @@ -82,6 +80,4 @@ static inline struct page *boot_pfn_to_page(unsigned long boot_pfn) > > #endif /* __ASSEMBLY__ */ > > -#endif /* CONFIG_KEXEC */ > - > #endif /* _ARM_KEXEC_H */ > diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec > index 7aff28ded2f4..1cc3b1c595d7 100644 > --- a/kernel/Kconfig.kexec > +++ b/kernel/Kconfig.kexec > @@ -97,7 +97,6 @@ config CRASH_DUMP > depends on ARCH_SUPPORTS_KEXEC > select CRASH_CORE > select KEXEC_CORE > - select KEXEC > help > Generate crash dump after being started by kexec. > This should be normally only set in special crash dump kernels > -- > 2.41.0 >
On 11/23/23 at 08:23am, Ignat Korchagin wrote: > On Thu, Nov 23, 2023 at 7:37 AM Baoquan He <bhe@redhat.com> wrote: > > > > Ignat Korchagin complained that a potential config regression was > > introduced by commit 89cde455915f ("kexec: consolidate kexec and > > crash options into kernel/Kconfig.kexec"). Before the commit, > > CONFIG_CRASH_DUMP has no dependency on CONFIG_KEXEC. After the commit, > > CRASH_DUMP selects KEXEC. That enforces system to have CONFIG_KEXEC=y > > as long as CONFIG_CRASH_DUMP=Y which people may not want. > > > > In Ignat's case, he sets CONFIG_CRASH_DUMP=y, CONFIG_KEXEC_FILE=y and > > CONFIG_KEXEC=n because kexec_load interface could have security issue if > > kernel/initrd has no chance to be signed and verified. > > > > CRASH_DUMP has select of KEXEC because Eric, author of above commit, > > met a LKP report of build failure when posting patch of earlier version. > > Please see below link to get detail of the LKP report: > > > > https://lore.kernel.org/all/3e8eecd1-a277-2cfb-690e-5de2eb7b988e@oracle.com/T/#u > > > > In fact, that LKP report is triggered because arm's <asm/kexec.h> is > > wrapped in CONFIG_KEXEC ifdeffery scope. That is wrong. CONFIG_KEXEC > > controls the enabling/disabling of kexec_load interface, but not kexec > > feature. Removing the wrongly added CONFIG_KEXEC ifdeffery scope in > > <asm/kexec.h> of arm allows us to drop the select KEXEC for CRASH_DUMP. > > Hm... With the patch, when cross compiling for arm and > CONFIG_KEXEC_CORE=y > # CONFIG_KEXEC is not set > CONFIG_CRASH_DUMP=y > > I get the following linker error at the end: > > CALL scripts/checksyscalls.sh > UPD include/generated/utsversion.h > CC init/version-timestamp.o > LD .tmp_vmlinux.kallsyms1 > arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `kimage_free': > kexec_core.c:(.text+0xf5c): undefined reference to `machine_kexec_cleanup' > arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `__crash_kexec': > kexec_core.c:(.text+0x15bc): undefined reference to `machine_crash_shutdown' > arm-linux-gnueabi-ld: kexec_core.c:(.text+0x15c4): undefined reference > to `machine_kexec' > arm-linux-gnueabi-ld: kernel/kexec_core.o: in function `kernel_kexec': > kexec_core.c:(.text+0x1a04): undefined reference to `machine_kexec' > make[2]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 1 > make[1]: *** [/home/ignat/git/linux-upstream/Makefile:1154: vmlinux] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 Oops, I forgot this part. This should fix the link error. diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index d53f56d6f840..771264d4726a 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -59,7 +59,7 @@ obj-$(CONFIG_FUNCTION_TRACER) += entry-ftrace.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o patch.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o patch.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o -obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o +obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o # Main staffs in KPROBES are in arch/arm/probes/ . obj-$(CONFIG_KPROBES) += patch.o insn.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h index e62832dcba76..a8287e7ab9d4 100644 --- a/arch/arm/include/asm/kexec.h +++ b/arch/arm/include/asm/kexec.h @@ -2,8 +2,6 @@ #ifndef _ARM_KEXEC_H #define _ARM_KEXEC_H -#ifdef CONFIG_KEXEC - /* Maximum physical address we can use pages from */ #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) /* Maximum address we can reach in physical address mode */ @@ -82,6 +80,4 @@ static inline struct page *boot_pfn_to_page(unsigned long boot_pfn) #endif /* __ASSEMBLY__ */ -#endif /* CONFIG_KEXEC */ - #endif /* _ARM_KEXEC_H */ diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec index 7aff28ded2f4..1cc3b1c595d7 100644 --- a/kernel/Kconfig.kexec +++ b/kernel/Kconfig.kexec @@ -97,7 +97,6 @@ config CRASH_DUMP depends on ARCH_SUPPORTS_KEXEC select CRASH_CORE select KEXEC_CORE - select KEXEC help Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels