Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2669492imi; Mon, 25 Jul 2022 05:08:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6/52EUlL5Q/f3yo3ZFqQg64YPLyc5Qh5ORjGU9h+GqT/u7N0/4WOpu2GG/6WZTiWNyqKY X-Received: by 2002:a05:6902:4d:b0:66c:9e74:b9fb with SMTP id m13-20020a056902004d00b0066c9e74b9fbmr8648602ybh.47.1658750880639; Mon, 25 Jul 2022 05:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658750880; cv=none; d=google.com; s=arc-20160816; b=ejLnPB/qwz9Pv3V44A0xmpaY2N313dc9nYNxYvD6JzQHgfIPtsk76Y6RhUuSsL0D5+ V6nFVfgBNoQ8oeK/JAioknjkZBP/7UCr6RPW4UHBLB7fy6cJ5wjhttAUCkm1EOoAqOsy gGYLGa6T4w7EfazbRHcoYdeH6TQ0A7eZ7kHYOIAr+7Ng0kDc4DwO2NRWe+/uf96FM1l/ cAA0RzctrwsIVe+N4Etam2X8Ep5IuZiBTfgpbiOkRrlbx0lse9w0g5kWbg8cVTwxxl5d lMjZ61di7+8cPbnfd4mAVeSdxzP/j7G5T4EOY8qLJZxoyCM3Zm9ii3AHqU7xq0j0tPPH vQ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=azjCJStYinlUJkGMIRNeZrFjUm/sCt/hfpBDbAEn+tQ=; b=PNkc9a1WhgurEyzs7KjBx2H3bMof9Y9vxfkgcZi/XdJPPCWX8Rz2csEggqXxfer9JL x8edrD3LzwjD8m7MAHTtghycTnjNdlrjHY/iysOVlRe3A22fIJTAwIobULZRFnyZpPnh 9Msgu7YaaXg6uq2buvzR3uKFW9IE/6FWp5ItUsGDc7yXc7A+vwwsFizLusXaXwOZiMW5 cs6ljsZYR8Bc9I7j0SoJDYsOc9c4eQ4dNxHy9WAE+fAUD23MlUXb+dUrHSJvU1o5qOu1 pKQFRmkK7sgTRyTwnL9owAOksMVtxprPegzLVNy14g244VD13AFynxQpwqsTb7r2bI6g HwPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=eKDHv04j; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j71-20020a81234a000000b0031ec73b26e8si4566081ywj.524.2022.07.25.05.07.26; Mon, 25 Jul 2022 05:08:00 -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; dkim=pass header.i=@canonical.com header.s=20210705 header.b=eKDHv04j; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234115AbiGYLuH (ORCPT + 99 others); Mon, 25 Jul 2022 07:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbiGYLuF (ORCPT ); Mon, 25 Jul 2022 07:50:05 -0400 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0FF3DF4A; Mon, 25 Jul 2022 04:50:04 -0700 (PDT) Received: from quatroqueijos (1.general.cascardo.us.vpn [10.172.70.58]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 0C31D3F11C; Mon, 25 Jul 2022 11:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1658749802; bh=azjCJStYinlUJkGMIRNeZrFjUm/sCt/hfpBDbAEn+tQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=eKDHv04jEAYFHhgugB5OGbPXzYU8hXVTUZzwQUZMuKH6Ik4JJPlj6pBYSCu3CcZGC NKTSpjgl+g8qKa9ir3t0/lG7GikRSRYc/F9arW61g6ZCSBRhFPEOg9c6BtrzlGx+pV W5xzFEPouViUrJNdd5eyjovPVb9e/jUr4LxtsKMeTS37P1bzO73OUlNtX9wznzKVDf G+pR9HJ9uQIBUU4YC23NPGBpqEExLezNTPiss4PqRMiRQmJVV9nG5ndSCoSsf3rz7n ae8Ohbpj8yyFcbXeh1JfO2yBb33u3Q8vDThsa0755EIwtv2nWYRrU+1Z2LqkOSs3xo DDp+8ARn5CehQ== Date: Mon, 25 Jul 2022 08:49:56 -0300 From: Thadeu Lima de Souza Cascardo To: Jiri Slaby Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra , Borislav Petkov Subject: Re: [PATCH 5.18 13/70] objtool: skip non-text sections when adding return-thunk sites Message-ID: References: <20220722090650.665513668@linuxfoundation.org> <20220722090651.464856922@linuxfoundation.org> <8a4f10b1-70b3-25fe-9ffc-4f24a1531139@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a4f10b1-70b3-25fe-9ffc-4f24a1531139@kernel.org> X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Mon, Jul 25, 2022 at 07:44:08AM +0200, Jiri Slaby wrote: > 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.) > That's because RESERVE_BRK adds a function to .discard.text before upstream commit a1e2c031ec3949b8c039b739c0b5bf9c30007b00 ("x86/mm: Simplify RESERVE_BRK()"). Picking up that commit alone was frowned upon because it caused some problems that were still under investigation. Cascardo. > 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