Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp34778imu; Wed, 7 Nov 2018 12:31:11 -0800 (PST) X-Google-Smtp-Source: AJdET5drbfz9d6Y1wS1HYruFPVz8mwTpBMMKWnKhYIgXNXC25v5oDae/ERjJ5Yxydt5YVU2gjs/Y X-Received: by 2002:a63:2ad4:: with SMTP id q203-v6mr1440140pgq.356.1541622671729; Wed, 07 Nov 2018 12:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541622671; cv=none; d=google.com; s=arc-20160816; b=beGx0iCnhgkoJR78JQlIfRHgU+/hXvwD6IbkvRLJVMh4kPORRkFmfsUBKS4v6f0aZC jokVutP1Oaw0eoS4OoQZJk00Zh6Qf2mC3plWO+AzdoenfSghT735MLR2P0dwjXDn2SFx qXtPfhCQ7CA2JtCRfdtpCtNXkCdIaCaFTjowwsPDp37M49A80O2CwMtjlFiFOUzc0jah ClSLccmlnio7cZXUAcxve3Oe47N2Npm2CdMeFWRVugItoTGHLJm+bS41Yv7EFJ7n/JCn XAPlx0q2v7VvTZXJCZi1nPhx7c8GrhCgmwiO3QVw5j6Ll0VEtwAtKTW3LdWsjB+Ed7wb Ho7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Fi6rg5sJt5xG5xvFNKqpcnG1I36JVOhGiMRCBuxHBpw=; b=dCOEQ3lt1jzwZef7KtByyDt00UMCLhHxcxXJh0PQi915er1x5tGW5jjwWGaz/sAkMg S8+/OUJtuik23s11X9cReLZHSyQXft98JBNDGBBgcs3gjwRZO6IEevPHV7DElrO+tkaN AJWjAhhuYm+2iJMfujz1PtLufJVaQ/YZnm/VRFmfUh5XeEgYSw2Y9Huz4/wQUCAEpk+7 2YPQHpEPQeqCLjzEH5b0yTlKLZfXGapQ4KQuryeQSq9EaG4ZBFZ69D1RAf5LwpdMt0wG OPh1v3oAryBjqXCUVxVZw6VWL0HiX1P3+SJit5wuxUL3MD0K/MUTy2Q/qois4ia586wP J9Fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si1435960pgm.175.2018.11.07.12.30.29; Wed, 07 Nov 2018 12:31:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbeKHGBo (ORCPT + 99 others); Thu, 8 Nov 2018 01:01:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60000 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbeKHGBo (ORCPT ); Thu, 8 Nov 2018 01:01:44 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97236307DAA9; Wed, 7 Nov 2018 20:29:44 +0000 (UTC) Received: from treble (ovpn-121-72.rdu2.redhat.com [10.10.121.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1390060851; Wed, 7 Nov 2018 20:29:43 +0000 (UTC) Date: Wed, 7 Nov 2018 14:29:42 -0600 From: Josh Poimboeuf To: Artem Savkov Cc: Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH] objtool: fix .cold. functions parent symbols search Message-ID: <20181107202942.s24ej5mnh4b3mflw@treble> References: <20181107140559.28504-1-asavkov@redhat.com> <20181107170856.usgyzckfirem5qh7@treble> <20181107184246.GC11183@shodan.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181107184246.GC11183@shodan.usersys.redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 07 Nov 2018 20:29:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 07:42:46PM +0100, Artem Savkov wrote: > On Wed, Nov 07, 2018 at 11:08:56AM -0600, Josh Poimboeuf wrote: > > On Wed, Nov 07, 2018 at 03:05:59PM +0100, Artem Savkov wrote: > > > The way it is currently done it is possible for read_symbols() to find the > > > same symbol as parent for ".cold" functions. > > > > I seem to remember having this discussion for kpatch-build, but I forget > > the details. Can you explain how this can happen (and also add that > > detail to the commit message)? > > find_symbol_by_name() traverses the same lists as read_symbols and when > we change sym->name in place without copying it it changes in the list > as well. So if child function is before parent in sec->symbol_list the > same function will be returned as "parent". Ah, I see. > It is hard for me to put it into words worthy to be included into > commit message. The above description made sense to me, so it sounds like you're on the right path :-) > > I haven't seen any bug reports, is it purely theoretical? > > No, 4.20-rc1 (actually anything after 4a60aa05a063 "objtool: Support > per-function rodata sections", before that add_switch_table() doesn't > seem to be called for those .cold. funcs) fails to build for mewith > KCFLAGS="-ffunction-sections -fdata-sections" because objtool is > segfaulting. If you only see it triggered with -ffunction-sections, that would be another useful nugget for the commit log. Also, if it's fixing a regression, be sure to add the 'Fixes' tag. Thanks! -- Josh