Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8082970rwi; Tue, 25 Oct 2022 02:09:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bYL9nj/a0MqGo6PiZC717d7f0IBTnVlRrP7oTRYvpjDLE8PrUPhPU3qTmEClPlIIDyfPG X-Received: by 2002:a05:6402:4511:b0:45c:b2b4:3e69 with SMTP id ez17-20020a056402451100b0045cb2b43e69mr34354652edb.339.1666688974920; Tue, 25 Oct 2022 02:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688974; cv=none; d=google.com; s=arc-20160816; b=EGIuC7DoMUBvok46WGLfhGSeg0ayogBVFYMz4k07+oVyYZ4XglE3gl6p1W69atr1Kc E/QWz65BxNJb1oT/Keh2JtYYokcEW35bp2pEvSsJTjiW2St6X7y9itSuiwR6CiCuNRS9 Ub8pHe1AGfr3sZ5eCjWHbElf//tbNhZfedDV/+ZpkharIk0modq/Pu0AmDTHti/E1n0+ aTFeMXQk/IfU3xvHa4YzLPwJwBi/2HhMpAESD7IMSrGXqgeWFhbig/fxu5vxn6gi0Jc7 QS0slIeVVYLAxJ6TDmTU+G+Z4WG4OecIJ7QTr04xdIi6IWFyuTFvS5sodRxAs3olMV0m oIaA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=LOHJwdawIM4PXdHtY0Ct7w/jUIqBfPxUONVg66B34cI=; b=xFUf5Ict3OuoR0L+i8ccqnBa39Wcx4CAkQWuOyxoabwhTk4qXZ/ice9fjhSSxIKlNX UBOYhNWucmpKO9tkiFHWHe40JvtTsfovdEt+XeqeH9BqQhDsEDsKmLoZ6GSlGDF/0mbr NduBgd+pkhRImkC+oyPlOzwFNMqH+v7lc+rLzP1apM1uukmt50bNsyc49GW/ZQmp9iXP kef1o8tbdTn2da/rY/t7MWM5I+cAYteeTHzTQFDhV0EY69d8IjxC1klzWuKZ8tk2gT+D eGuvOo4sP14RPQGzIL5TG/Ca8YpRhIL7u2C8zbNAHYU39tXAZ0RJ9pjw0OP99F3LaZgg 30RA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp20-20020a170906c15400b00781f51771b6si2530009ejc.900.2022.10.25.02.09.09; Tue, 25 Oct 2022 02:09:34 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbiJYIwu (ORCPT + 99 others); Tue, 25 Oct 2022 04:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbiJYIw0 (ORCPT ); Tue, 25 Oct 2022 04:52:26 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CF5910042C for ; Tue, 25 Oct 2022 01:52:18 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=irc.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1onFfP-0003Br-Nl; Tue, 25 Oct 2022 10:52:11 +0200 Message-ID: <6ce9877bdf4ac5822786f8ae1ffe3c05aa76aea6.camel@pengutronix.de> Subject: Re: PROBLEM: Segfault in kconfig From: Johannes Zink To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Tue, 25 Oct 2022 10:52:07 +0200 In-Reply-To: References: <33059074b78110d4717efe09b887dd28ac77fe7f.camel@pengutronix.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: j.zink@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 Hi Masahiro,  thank you for looking into the issue. I will check out your patch as soon as I return from netdevconf next week and test it. Best regards Johannes On Mon, 2022-10-24 at 04:23 +0900, Masahiro Yamada wrote: > Hi Johannes, > > > Sorry for the delay. > > I took a closer look at this. > > > I submitted a patch, which I think is a more correct fix. > > https://patchwork.kernel.org/project/linux-kbuild/patch/20221023191055.85098-1-masahiroy@kernel.org/ > > > > Thanks. > > > On Thu, Oct 6, 2022 at 10:15 PM Johannes Zink > wrote: > > > > Hi everyone, > > > > On Thu, 2022-09-22 at 18:01 +0200, Johannes Zink wrote: > > > Hi everyone, > > > > > > [1.] One line summary of the problem: > > >      kconfig crashes with segfault under rare circumstances > > > [2.] Full description of the problem/report: > > >      Under certain circumstances jump keys are displayed on the > > > search > > >      results even if a symbol is deactivated by one of its > > >      dependencies. Using the jump keys then triggers a > > > segmentation > > >      fault due to a NULL dereference. Perform the following steps > > > to > > >      trigger the issue > > > > > >      1.: ARCH=arm64 make defconfig > > >      2.: ARCH=arm64 make menuconfig > > > > > >      3.: press '/' key to search for the string "EFI". Use jump > > > key > > >          (1) to jump to search result. Press 'n' key to > > > deactivate > > > the > > >          entry. > > >      4.: press '/' to seach for the string "ACPI". Use the jump > > > key > > >          (1) to jump to the search result. > > > > > >      Menuconfig then crashes with a segfault. > > > > > > [3.] Keywords (i.e., modules, networking, kernel): > > >      kconfig, mconf > > > [4.] Kernel information > > > [4.1.] Kernel version (from /proc/version): > > >        v6.0.0-rc6 > > > [4.2.] Kernel .config file: > > >        arm64 default defconfig > > > [5.] Most recent kernel version which did not have the bug: > > >      v5.15 > > > [6.] Output of Oops.. message (if applicable) with symbolic > > > information > > >      resolved (see Documentation/admin-guide/bug-hunting.rst): > > >      not applicable > > > [7.] A small shell script or example program which triggers the > > >      problem (if possible): > > >      not applicable, please see description in [2.] > > > [8.] Environment > > > [8.1.] Software (add the output of the ver_linux script here): > > >        not applicable > > > [8.2.] Processor information (from /proc/cpuinfo): > > >        not applicable > > > [8.3.] Module information (from /proc/modules): > > >        not applicable > > > [8.4.] Loaded driver and hardware information (/proc/ioports, > > > /proc/iomem): > > >        not applicable > > > [8.5.] PCI information ('lspci -vvv' as root): > > >        not applicable > > > [8.6.] SCSI information (from /proc/scsi/scsi): > > >        not applicable > > > [8.7.] Other information that might be relevant to the problem > > >        (please look in /proc and include all information that you > > >        think to be relevant): > > >        not applicable > > > [X.] Other notes, patches, fixes, workarounds: > > > > > >      I found that the attached patch is a very hacky workaround > > > to > > >      keep menuconfig from crashing, but I am pretty sure the jump > > >      keys should not have be activated for unaccessable entries > > > in > > > the > > >      first place. I found it quite hard to find the corresponding > > > part > > >      in mconf, which is why I decided to send this bugreport > > > instead > > >      of sending a patch. Maybe someone on this list either knows > > > mconf > > >      really well and can just fix it, or guide me to where I can > > > dig > > >      around (though in that case I could really use some help on > > > how > > >      to debug menuconfig, since I found it challenging to get it > > >      working with gdb) > > > > > > Best regards > > > Johannes > > > > > > --- > > > scripts/kconfig/mconf.c | 3 ++- > > >  1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c > > > index 9d3cf510562f..60a82f701bd3 100644 > > > --- a/scripts/kconfig/mconf.c > > > +++ b/scripts/kconfig/mconf.c > > > @@ -447,7 +447,8 @@ static void search_conf(void) > > >                 again = false; > > >                 for (i = 0; i < JUMP_NB && keys[i]; i++) > > >                         if (dres == keys[i]) { > > > -                               conf(targets[i]->parent, > > > targets[i]); > > > +                               if (targets[i]->parent) > > > +                                       conf(targets[i]->parent, > > > targets[i]); > > >                                 again = true; > > >                         } > > >                 str_free(&res); > > > > > > > Just a gentle ping and TL;DR on this issue: > > > > Menuconfig crashes with a segfault if performing the steps > > > > 1.: ARCH=arm64 make defconfig > > 2.: ARCH=arm64 make menuconfig > > 3.: press '/' key to search for the string "EFI". Use jump key > >     (1) to jump to search result. Press 'n' key to deactivate > >     the entry. > > 4.: press '/' to seach for the string "ACPI". Use the jump key > >     (1) to jump to the search result. > > > > For more details please see the detailed report in the original > > message. > > > > Has anyone any input on this? > > > > Best regards > > > > -- > > Pengutronix e.K.                | Johannes Zink                  | > > Steuerwalder Str. 21            | https://www.pengutronix.de/    | > > 31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       | > > Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    | > > > > -- Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |