From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F30A4C433DF for ; Thu, 20 Aug 2020 09:59:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C72CF208DB for ; Thu, 20 Aug 2020 09:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917586; bh=G80p+F5PFv1MM5G7UpJnUbfT9H38kAuzrH119I2A4xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cLtQ/xQy6LhfmQ47EviWlf+9UXCXPpoXQx+FGA+wbPFiiWXgy+rRKUz9oQU8nsTcZ j2X2xyTA5YOGMS7Hb4lGrdMnHJcHiQaP9ZirXLHCuB/x0GFeg8HCpBr8ULyZr743Cv sbInUYk2kwfL0Knb45yYxGUEnxWS/hw4B0rpFPbY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730279AbgHTJ7n (ORCPT ); Thu, 20 Aug 2020 05:59:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:46026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730431AbgHTJ7c (ORCPT ); Thu, 20 Aug 2020 05:59:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E7F2320855; Thu, 20 Aug 2020 09:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917572; bh=G80p+F5PFv1MM5G7UpJnUbfT9H38kAuzrH119I2A4xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAxfkEr8tj445c989i8ht2Iyty428a6Pqgi5lneD8Q97Q559wfIz3qxkUtjjp3mh5 1hK2spvi5knckOrXb21vTqzJ2uiSuFlvhZ6zfa+bm0LtRDe/vN9Kqfr3jujbqjXRoR xoW/2mtKKzIqdIGO63coqbdrdU+HoSarOXwLByxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Miguel Ojeda , Tim Murray , Simon MacMullen , Greg Hackmann , Nick Desaulniers , "Steven Rostedt (VMware)" Subject: [PATCH 4.9 079/212] tracepoint: Mark __tracepoint_strings __used Date: Thu, 20 Aug 2020 11:20:52 +0200 Message-Id: <20200820091606.358577989@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091602.251285210@linuxfoundation.org> References: <20200820091602.251285210@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Desaulniers commit f3751ad0116fb6881f2c3c957d66a9327f69cefb upstream. __tracepoint_string's have their string data stored in .rodata, and an address to that data stored in the "__tracepoint_str" section. Functions that refer to those strings refer to the symbol of the address. Compiler optimization can replace those address references with references directly to the string data. If the address doesn't appear to have other uses, then it appears dead to the compiler and is removed. This can break the /tracing/printk_formats sysfs node which iterates the addresses stored in the "__tracepoint_str" section. Like other strings stored in custom sections in this header, mark these __used to inform the compiler that there are other non-obvious users of the address, so they should still be emitted. Link: https://lkml.kernel.org/r/20200730224555.2142154-2-ndesaulniers@google.com Cc: Ingo Molnar Cc: Miguel Ojeda Cc: stable@vger.kernel.org Fixes: 102c9323c35a8 ("tracing: Add __tracepoint_string() to export string pointers") Reported-by: Tim Murray Reported-by: Simon MacMullen Suggested-by: Greg Hackmann Signed-off-by: Nick Desaulniers Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- include/linux/tracepoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -314,7 +314,7 @@ extern void syscall_unregfunc(void); static const char *___tp_str __tracepoint_string = str; \ ___tp_str; \ }) -#define __tracepoint_string __attribute__((section("__tracepoint_str"))) +#define __tracepoint_string __attribute__((section("__tracepoint_str"), used)) #else /* * tracepoint_string() is used to save the string address for userspace