Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2490095imi; Sun, 24 Jul 2022 22:52:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sG1OTPPr/kSjCReULohhrhI+nkQ/Hnhu+y2QS+4p55Ev31/b8Q61mkbEdCkM4qFm8+BQYe X-Received: by 2002:a05:6402:e96:b0:43a:f21f:42a0 with SMTP id h22-20020a0564020e9600b0043af21f42a0mr11758030eda.382.1658728347603; Sun, 24 Jul 2022 22:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658728347; cv=none; d=google.com; s=arc-20160816; b=ITM9CJLsgqmeeMJVgtt03cf5ryokAQNaBHRqgEkHmCxoj4nSZycv7mA5BHLETdRJzI nXa9iYCYQAqyPA7a78ALsHae5zwWHW4Y4nabYoD8ohDZQwFUfBSGH/mIQQGwgeqzPSNd 4N7pJFtUInMylhgf5VnefdMPXPJPXSsPzXP6zli/IjdYpD10YZuiwjNi/tjifM360Yeu Vzmpx3ANIMQUkrziHwKB/N816N5QqtFbqQC7/sNDmi82pgbtq0zhsxSqzEvxOCIqXO18 sL1IvzVXLxRDjPCWaNhC0fdcyQMXgdfJcacyvPw8L1Qobgy8LpN3vqpBFQ+3K9hm0OVd xkCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=j+TMKKTWkt93wyAShA8GcS53wvc9Ih1A4htlfT9K7Ho=; b=p8L1ngAATLlvdGsoQrLby1PrmhzaEFexjmecqH42Z7OAGt1QzqaqnT5kY7ZVm/QJ19 Pu6uhKSIPFgisBaoN7mFK5u2tJy0M21Kh8J+SN7A8hSb+Aqo+fZEqhsv2iBN0I8CSdv+ 1nFJRwUeqoeAS+KW2pxYPae16DcRVn2PjS8QI72ebKaAIDJPQMkRgMLkTtuo5AgV/eb8 sI/xR8Djh2cnCGFY9prQFpg4cWfgKzj4dtmI4/0TB5mHvTIMV6uOKr2HIwpatg71ltmr AOAMPBJno8W8Co3lhoUUwZqE18bXgs47mDMcWeLU6NEPgr6QnYXBxIFZo5ZuaiHHDzzC igkg== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di13-20020a170906730d00b0072f0b024d39si8511624ejc.740.2022.07.24.22.52.00; Sun, 24 Jul 2022 22:52:27 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbiGYFoN (ORCPT + 99 others); Mon, 25 Jul 2022 01:44:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232137AbiGYFoM (ORCPT ); Mon, 25 Jul 2022 01:44:12 -0400 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8597658; Sun, 24 Jul 2022 22:44:11 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id b6so6102780wmq.5; Sun, 24 Jul 2022 22:44:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=j+TMKKTWkt93wyAShA8GcS53wvc9Ih1A4htlfT9K7Ho=; b=T1T3RCRB8Vx9gQ7AY60KabJX4o1QLZMuP5BHO/3jX0yP9BGyal48GaaVf9woBoP6Yo 9AKx/1tbR3dOYXoiLyxAlvLsqDmpkve/m/DH7HAj7xyS6PCWBC0e9mNDtH4o+aQmpfwN gEIpCMSjgvOvwRjcjbjWJLl+baoab86UwJLAJuAgRcAcl93LmaRNcUpAXEg9R2/wixnj +LEAw3zku6EQI7aUe931lps4nDfOQwjjSjRhq8+0k50O6YDtMjWD8dvFWVDFeDxvc3I3 zwQ8YOvUWy8ojKN/MAGz8/bNZXaOR6qHF6PHc1qylll4eYLbtYSuKyZFr+6VWeKkPhp2 UBDw== X-Gm-Message-State: AJIora9eScE6B818S86mCwQxVgIycPjewVWoFFkUPx2XfCwTMIVr0USR V23+0VJfGVO2HSfIBV1bINk= X-Received: by 2002:a05:600c:2651:b0:3a3:1b8d:d9c8 with SMTP id 17-20020a05600c265100b003a31b8dd9c8mr20308470wmy.160.1658727849689; Sun, 24 Jul 2022 22:44:09 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id t11-20020a5d460b000000b0021b970a68f9sm10736171wrq.26.2022.07.24.22.44.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jul 2022 22:44:09 -0700 (PDT) Message-ID: <8a4f10b1-70b3-25fe-9ffc-4f24a1531139@kernel.org> Date: Mon, 25 Jul 2022 07:44:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 5.18 13/70] objtool: skip non-text sections when adding return-thunk sites Content-Language: en-US To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Josh Poimboeuf , Peter Zijlstra , Borislav Petkov References: <20220722090650.665513668@linuxfoundation.org> <20220722090651.464856922@linuxfoundation.org> From: Jiri Slaby In-Reply-To: <20220722090651.464856922@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no 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, I wonder, why this is needed in stable and not mainline? Isn't this a different (non-upstream) dup of 951ddecf4356 objtool: Treat .text.__x86.* as noinstr ? (That is included in this release too.) On 22. 07. 22, 11:07, Greg Kroah-Hartman wrote: > From: Thadeu Lima de Souza Cascardo > > The .discard.text section is added in order to reserve BRK, with a > temporary function just so it can give it a size. This adds a relocation to > the return thunk, which objtool will add to the .return_sites section. > Linking will then fail as there are references to the .discard.text > section. > > Do not add instructions from non-text sections to the list of return thunk > calls, avoiding the reference to .discard.text. > > Signed-off-by: Thadeu Lima de Souza Cascardo > Acked-by: Josh Poimboeuf > Signed-off-by: Greg Kroah-Hartman > --- > tools/objtool/check.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/tools/objtool/check.c > +++ b/tools/objtool/check.c > @@ -1308,7 +1308,9 @@ static void add_return_call(struct objto > insn->type = INSN_RETURN; > insn->retpoline_safe = true; > > - list_add_tail(&insn->call_node, &file->return_thunk_list); > + /* Skip the non-text sections, specially .discard ones */ > + if (insn->sec->text) > + list_add_tail(&insn->call_node, &file->return_thunk_list); > } > > static bool same_function(struct instruction *insn1, struct instruction *insn2) > > thanks, -- js suse labs