Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1009440lqt; Tue, 19 Mar 2024 10:04:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0jXbpnIXFVpJqxDWeD6e92fCqpxeGiwTUx+tr7nKCjyogSMKK0jt+TzIEuloNisHZ6YW2mQFBdYq/MnKknSD1rGLAZODIDcv08yADPA== X-Google-Smtp-Source: AGHT+IGyEcPekzu6Zos2/iydkYam+1VqbTLpi+Prl9pxY38l9OkthxjrIjXYrAJnB5iux8iJ4bfp X-Received: by 2002:a05:6870:fb8f:b0:221:416:1df9 with SMTP id kv15-20020a056870fb8f00b0022104161df9mr18737112oab.23.1710867879946; Tue, 19 Mar 2024 10:04:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710867879; cv=pass; d=google.com; s=arc-20160816; b=R7GrMPNjYDSokmmEknRPkiR9HAeyzEKkqKnb/+SlSt+soz93gKbU6ONCnHVnX/tK7F uwUMTgACcxPAR4O4u975IpZyu/PElEqJl9HbVwC/wFwAwtuIjlz4wlZAvwseluSyBZtF hSlkEt3bz2EGhg+pxvmh80NIH8jgbE6/33ALGq9pzZvt2eJudPnMy+NjxlMv5uvF5l9a sHOam122iUSWBAYYIyjDsq2U3H6YnqxgzJDt8o1wdw6QZr+rJpT9Y40iAkSqt0RHjQ9Y 0hC6QwEWDJg04VbHXtLRFGr0asZpr+eHaRPCVjJ5O9kvTl3jgNK9lJhR+BXiNnnFTqLl APfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=L6alhMD3nIktm3wzrtD3lfOTYKWkFDqYic6rD5vNiFA=; fh=2W2CxoUWBITYWEypmpcoxwnk/wMvjYmNwyO/jWIYVUQ=; b=RJa2GtaC3zhf0Hq22sMKfy4wHVzlzMcQC4nvJH9jP4f8cdkVqujN4DWHr9zyqH+AAf KsjFnM+QcKqIi9b7P8ZVRbQIXFCmoCRVosLx5yR5+3AM6dzOVf2eUglXtaX9DaArYnl/ hAe4UkXhD/wdmlWWvcRIzZ6Faj7+amL3yRaXpCenh+7HhZDc0n2HzhnKeeuttnMYYTB0 YKmlqphiRgw/k7ZBIIFgam0iX82L7XXdbHZQmluWBMFSEIbsGOJE7xfhKmhNTuIdRSyT KgfkNJA/Ww8kWkkeh9RzA2y+mGUuLv9JAvBkS54YpitCBTHa7S129sWoXXYVJxF38OxQ N3og==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-107884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107884-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g23-20020a02cd17000000b0047711d7b1b9si4111967jaq.41.2024.03.19.10.04.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 10:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-107884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107884-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8BE30281B04 for ; Tue, 19 Mar 2024 17:04:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7164213ACC; Tue, 19 Mar 2024 17:04:33 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F17C6111B1 for ; Tue, 19 Mar 2024 17:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710867873; cv=none; b=KLNq8orYQZ65FjNiwPBgeS4bML01R+MkYTMjgunS6Vf4CMkBpy6W/uhIIqI4vHhHPhDLa83CLuiuHL/ehvMTQDvVoa4235jiRWmtN+hATsaDFmuBU8KCQVu5XJI7Nmnu57o3kRIElK5CnuOiDIg0nyKQS9pcaD2v5qgfhivaEuY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710867873; c=relaxed/simple; bh=0f0Lamjx/p5FWofoisDahieLZWYw9/EunEeJsbYhEV8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bbITUaqMeSGwCiNRib9FA/+nF13SIvnag41erDVEk5LAcX+n1k4MJufgrF2vtnL52qVMXjudxE3qskwH3Dmoel2Q2IbN9gMldoqS5y+ue0e//LZmDCwAALQSkXauEflcV1yEoSxvHVfgqCW9P16iRWPdoIX3eM9lcNbkXLNLRaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31E9DC433C7; Tue, 19 Mar 2024 17:04:31 +0000 (UTC) Date: Tue, 19 Mar 2024 13:06:53 -0400 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Masami Hiramatsu , Mathieu Desnoyers , Alison Schofield , Beau Belgrave , Huang Yiwei , John Garry , Randy Dunlap , Thorsten Blum , Vincent Donnefort , linke li Subject: Re: [GIT PULL v2] tracing: Updates for v6.9 Message-ID: <20240319130653.0cfdaf6e@gandalf.local.home> In-Reply-To: References: <20240318113053.7f87ce7f@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 19 Mar 2024 09:23:10 -0700 Linus Torvalds wrote: > On Mon, 18 Mar 2024 at 08:28, Steven Rostedt wrote: > > > > - Added checks to make sure that the source of __string() is also the > > source of __assign_str() so that it can be safely removed in the next > > merge window. > > Aargh. > > I didn't notice this initially, because it doesn't happen with gcc (or > maybe not with allmodconfig), but with clang I get > > CC [M] net/sunrpc/sched.o > In file included from net/sunrpc/sched.c:31: > In file included from ./include/trace/events/sunrpc.h:2524: > In file included from ./include/trace/define_trace.h:102: > In file included from ./include/trace/trace_events.h:419: > include/trace/events/sunrpc.h:707:4: error: result of comparison > against a string literal is unspecified (use an explicit string > comparison function instead) [-Werror,-Wstring-compare] > > and then about 250 lines ot messy "explanations" for how it was > expanded because it happens on line 709 too in the same macro, and it > ends up being three macros deep or something. > > So no, this all needs to be re-done. That > > WARN_ON_ONCE(__builtin_constant_p(src) ? \ > strcmp((src), __data_offsets.dst##_ptr_) : \ > (src) != __data_offsets.dst##_ptr_); \ > > does *NOT* work. In most all cases, src is not a constant and should always equal to what was passed to __string(), but if it is a constant like "some string" then clang warns that comparing pointers to strings is UB. That is, __string(src, mystring) [..] __assign_str(src, mystring); works, but if it has: __string(src, "this string"); then __assign_str(src, "this string"); is UB due to the compiler having two different pointers to "this string". I originally just had the "src != str" check but then it was reported that clang complained about it. It still complained with the __builtin_constant_p() but the code that it produced did the right thing. This is in the fast path (where the trace event happens), but I can make it always do strcmp(), even though it will slow down what is being recorded, as I plan on removing the parameter in the next merge window anyway. -- Steve