From patchwork Tue Aug 4 20:57:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 247435 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp692162ilo; Tue, 4 Aug 2020 13:59:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6vguKddtNR4gDV8NZ+oNYcyZcbbi4P6dBVko+MydyKNzCp5AHCxQoz428j/dfq69aTait X-Received: by 2002:a17:906:c1d8:: with SMTP id bw24mr22913888ejb.91.1596574741978; Tue, 04 Aug 2020 13:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596574741; cv=none; d=google.com; s=arc-20160816; b=DZUYQUlvMYEZvRGXExHR6wwDZ9bbZ08nujWz6pLC0BwqH4x0io7v2MAczl6zBxfYAP t0Xphq0vb0Pf4hJZqEHXR5WuFNFvasR7dTHJuDZ8OlcDAhGpjuHXlCy++IREXSFZWAyO hdr1Bk0KSWTdKpebuow15jLDNXeeDvjaOaWM37qhaLTMcphAqQVvq7ZzxhNIAZ6QiCys GOisvzeFQkpUHatasAKRvFgtwqdKt/9lF4p3+Yvgut8J3Wje06PVDEilt6p0MbJBgTyX 3iz/xf/SmvruiOECQfn+LXbL59MJVTVWaOY7WBPMDhX7N6fWkmJZBD9fH5CySjkQNNaj XBGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=M31F5cOfX7WA9CPPhVNu9d5wvla4XPFKzgLB/R7UYXM=; b=OxT7enSzWNS4xnvGDQRZ1yv0R7Tpd1NN2WE6tgvAZIC1qrIvCpmJltSziK792RTHwM COX8E7TPucIhc74eWxiWH8IGFjgExSbx8/ZeQwXkh3UtyF1Fe2PDzbkcSc8jPmcxjdl7 ztZlODjtPq1FrWdXLriqOBvi23tvcvsfQMMypobrh+e5+Ph30DKX/8V4ifOBXrTi909h B4fC+x4CmwKuX90XlIuVYIqdTmeXrIqQToCQUSy7D2tTcDahFhcRtxa+4JwnIRs1A1j6 +yTR+QztObZdDo4IgILghg5kgYNSSmRSeh1hOgPIrba1TV725bUXEppnqS8/kXCPJm66 YuLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj23si13744750ejb.482.2020.08.04.13.59.01; Tue, 04 Aug 2020 13:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgHDU7A (ORCPT + 15 others); Tue, 4 Aug 2020 16:59:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:42174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728095AbgHDU6Q (ORCPT ); Tue, 4 Aug 2020 16:58:16 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 539FA22CB2; Tue, 4 Aug 2020 20:58:14 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.93) (envelope-from ) id 1k340j-006HDS-Af; Tue, 04 Aug 2020 16:58:13 -0400 Message-ID: <20200804205813.223522602@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 04 Aug 2020 16:57:52 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Ingo Molnar , Miguel Ojeda , stable@vger.kernel.org, Tim Murray , Simon MacMullen , Greg Hackmann , Nick Desaulniers Subject: [for-linus][PATCH 09/17] tracepoint: Mark __tracepoint_strings __used References: <20200804205743.419135730@goodmis.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nick Desaulniers __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) --- include/linux/tracepoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.26.2 diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index a1fecf311621..3a5b717d92e8 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -361,7 +361,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) 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