From patchwork Thu Aug 20 09:22:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 248019 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp1228047ils; Thu, 20 Aug 2020 03:34:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMi2C7XsLbqu1iicLtpIcuQBU4gVNFYogNElPJ1lMb8KxiEUE+Y5nVcKWhgOZ6mL23/a6E X-Received: by 2002:a05:6402:3088:: with SMTP id de8mr2232750edb.88.1597919696111; Thu, 20 Aug 2020 03:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597919696; cv=none; d=google.com; s=arc-20160816; b=Maq2OMU1qdnnFP9xWLQe52kOwtx+UtBoRVgMFL9t/och6W3DzyjKuid6a9X88uFJBW CafEfEqkhJ5yvw0pnTD9sZ872Logktlu2IurIAjQqaf6gt+fnr9q64bmpgmKOtUQ6RgY QIWVhDXLDjzGBN66WUX7nD2i8nQ09WfeHajJR9PuU6ouNuA7/OzCAIch7nJEICfiNdh9 vt2Tw+Su4N/FgH5Tel4Y26c6j7huHL0YDM2BFCfq/0kFOaCn2Tat4kYUxjLO2PZ19ubJ 3AZLAbmOaYv1CAQxYKVx3ykyrXHh4xr/h/eXCn3/xO6JFmGLlEsliKwF8sGd/q/j8+/A 3QhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KaQ6ZTrO/FUnLy7qjC9P06ENi9ZaHlJC9PeivI/4ie0=; b=cnb3PcJrNjumopipReShfrTrGTrs67er7p1JQVFVs4yPo9rOXJrwUlVLy1bW+VJQfB MVrR/SlXU0BrBNS84xVUYCt0JAaFStLy8Au1Svlqg5Pvsw40i6OftlpWnun1ersNhVut 6kvrmOlw15n5UVk6FwUOH78FSLGRgsHH2/fyokZwlMHTdfbEBoGMRvMHTSiJkXEn4Csw wIK7fj1He3/j4447aC0hjjFWt/RrUKP5v9Gq1OYMblsRy3wfhhzaj4hlxKSW2a8wSAy9 bYDQesMaauuGtclsF/dmdMyPH5x0BGZBoNGH7w2itPXK5xMVxaDAR8efdGtexKdh+5Ov j+gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y7m/U16T"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si302378ejq.631.2020.08.20.03.34.55; Thu, 20 Aug 2020 03:34:56 -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; dkim=pass header.i=@kernel.org header.s=default header.b="Y7m/U16T"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729216AbgHTKTQ (ORCPT + 15 others); Thu, 20 Aug 2020 06:19:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:42492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731366AbgHTKTN (ORCPT ); Thu, 20 Aug 2020 06:19:13 -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 50DF12067C; Thu, 20 Aug 2020 10:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597918752; bh=0dL8pYVd9qMBr7zVzJoGqGXN8Z9c9tLEAYuKy1M5Sao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7m/U16TdyGLKiUpZ6bivOW1Jasf+OXXJmjyiY2zTUtozMHohQt4ELOWS60wc+nFh 84FckLpFG5r4EuhlQlDajcAHjjctx/vYPHDIAhS5DQ9HMOVemvZizVWHL2q3zcmNjr NZtiM4I686bXnZtTFlA9HRqMADUeBauZOIGEKgZE= 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.4 054/149] tracepoint: Mark __tracepoint_strings __used Date: Thu, 20 Aug 2020 11:22:11 +0200 Message-Id: <20200820092128.347118822@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820092125.688850368@linuxfoundation.org> References: <20200820092125.688850368@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -328,7 +328,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