Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp664469iog; Mon, 13 Jun 2022 10:09:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuHIS4AZTGmVZclOLLxQJilEw2JnHAWnJpATeXmpWXm1Bqtb534D4EkUjKAeNjNJSXpOF3 X-Received: by 2002:a63:6a43:0:b0:3fd:913e:9b02 with SMTP id f64-20020a636a43000000b003fd913e9b02mr535320pgc.540.1655140141111; Mon, 13 Jun 2022 10:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655140141; cv=none; d=google.com; s=arc-20160816; b=t8IJi3pa4aSkXOyb636JL5zAnuTm4XXm7Cmq6AWD+ylxR5efnkvGYlvnwi3uccUXVA OLJbD/TehxD9Sdb5cv/8O3IAEdllIaDeBfcuwajoLm55S8g4DPbvxbR8HF6XZPBo0RTw qX+n+WAHlhdBX7v9iBLydcHbiRn3ZWQVe5mQGwmHjW4FRSFtmCiZeHCXY705DHsuf6Iz 2pjIFOd2BoGODkQCh7/nQlIZrrguJdd7mmaJLTmBJfjY3GCjmhQJyS1POECJCia78sC6 1YEgKV9fterJO8NN8dsLXwd45P3Frp7aFW+CgIFnXnEgnxEkpY+KdGW/wYADTCuyCcDe K7Sg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=CDSataKjbgW9hzB6O2Mk2sO+egBIADwdKS5ZPg3+HiY=; b=ScLS7cCqDBiy/2aOZBYEUdS3dZzgDegkBs5juxhcjwXeyZhQVuP/g2hHbm9DMFAOTY OKf/w9WNZ53GHsFchF5nQ69CJJTRF2xF2ZBWbrXWVUfFjmWbMiXEo0SbxiXgt9ktIaS+ 26j2W/c7yG8jcI+nvroE6Qzfk+ryyplXu/yNGrKX2x7QijcAnv+PTMZ/NJ1N5d9/EMPZ GjZX+Xu5mE/0ojxd5SlZYxNzzYFJ3uCowB7nspxUS5rZK2FAWd8MiOdLSRBbCWSN8KOs uwlRpSX6MWZ8HBrtLw0jDPL973eU9sUEoPkVHz4qPrOmUMdgkfol3+Ivz+uBQWA+nP6m KlYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSZyhebb; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y30-20020a056a001c9e00b0050db6efbaedsi8369465pfw.105.2022.06.13.10.08.46; Mon, 13 Jun 2022 10:09:01 -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=@linuxfoundation.org header.s=korg header.b=VSZyhebb; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358385AbiFMNEQ (ORCPT + 99 others); Mon, 13 Jun 2022 09:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355492AbiFMM4E (ORCPT ); Mon, 13 Jun 2022 08:56:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40E7D12D0D; Mon, 13 Jun 2022 04:17:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B79A260B60; Mon, 13 Jun 2022 11:17:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5DADC34114; Mon, 13 Jun 2022 11:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119023; bh=EFH/jpz6Y7HbXvroxBQ+an5CCn0BgHUFSg7kxrGjx/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VSZyhebbLLKQ59ZhT0eFMw/ptpAJgdvH2JxmaF72eF3tghJQfhyMsQEtlO560Iw06 w5j48UeFqUxA56CUE5YPXAJ9xrn1ACbe9Tl10M1mqU6pWFdHawJONsiusq5Os6eyzr bDJNEbglAt0hZnOqqiPucglUi+J9WWqJrFqyYitM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Petr Mladek , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.15 076/247] modpost: fix removing numeric suffixes Date: Mon, 13 Jun 2022 12:09:38 +0200 Message-Id: <20220613094925.262644048@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094922.843438024@linuxfoundation.org> References: <20220613094922.843438024@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Alexander Lobakin [ Upstream commit b5beffa20d83c4e15306c991ffd00de0d8628338 ] With the `-z unique-symbol` linker flag or any similar mechanism, it is possible to trigger the following: ERROR: modpost: "param_set_uint.0" [vmlinux] is a static EXPORT_SYMBOL The reason is that for now the condition from remove_dot(): if (m && (s[n + m] == '.' || s[n + m] == 0)) which was designed to test if it's a dot or a '\0' after the suffix is never satisfied. This is due to that `s[n + m]` always points to the last digit of a numeric suffix, not on the symbol next to it (from a custom debug print added to modpost): param_set_uint.0, s[n + m] is '0', s[n + m + 1] is '\0' So it's off-by-one and was like that since 2014. Fix this for the sake of any potential upcoming features, but don't bother stable-backporting, as it's well hidden -- apart from that LD flag, it can be triggered only with GCC LTO which never landed upstream. Fixes: fcd38ed0ff26 ("scripts: modpost: fix compilation warning") Signed-off-by: Alexander Lobakin Reviewed-by: Petr Mladek Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index ca491aa2b376..7a5bddb8913e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1971,7 +1971,7 @@ static char *remove_dot(char *s) if (n && s[n]) { size_t m = strspn(s + n + 1, "0123456789"); - if (m && (s[n + m] == '.' || s[n + m] == 0)) + if (m && (s[n + m + 1] == '.' || s[n + m + 1] == 0)) s[n] = 0; /* strip trailing .lto */ -- 2.35.1