Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp183496rdb; Sat, 17 Feb 2024 04:27:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWCgdTovvPWnIDwBFRsBvSePRmwKGc3eNMb9hxuJ8EGjEEQbUA0lZtEyJBtWe5XlUb/3CgR3/wLYCV5HHS/pk8cyajELkb7mEd1a/wBhA== X-Google-Smtp-Source: AGHT+IHr3AWiCS1mw+97yv03IL+lZTu7PMwODMDfRrjRlitKdF7JMChkMMRRHQocfQwkit3aEeX6 X-Received: by 2002:a17:902:d512:b0:1db:cf64:7331 with SMTP id b18-20020a170902d51200b001dbcf647331mr941263plg.13.1708172839697; Sat, 17 Feb 2024 04:27:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708172839; cv=pass; d=google.com; s=arc-20160816; b=PE9asZPK5vckQDJCvV0SXkELyUk4FK18nu5at5wyOW9cLSviq8HZwQBu8MolBck9Lc B+nQs4h6LUmfjnTQRWgDJeRtDuAPq6jmJJ0W4NCxKLlUkIm5S2sQbnf48rvtiH5kn3KJ Bqrv5JmTABMN4YCcVysY3sx7wgrnjjjWPpCNVycprm196tWHwQ0xVFvAgQulJ3pqDS92 jaZXGrkMED8B7ENQuJuWzB2LH3+L70ODHai+ai2zk+Z12WqrTDC33oU+09V6YNF05kjg lusv5KeyEWCfXbSZ/mlLusuP4T/q/9CC7W25MUgN54bEjJ+H1aXPcvLftfaC9DOFeV7X g2+g== 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:dkim-signature; bh=Nq5VSpSJuKRbRRbzCGtrIjmBIlnkQ8Li+GV2/wHXq5U=; fh=uHCPLfg4D0mPFm5w38Hw0w2u4mbPbifWHG3tknIu60k=; b=VFXw/VqwlhckSywuhzCQ/7azoKr3ERBz0RPQne4bSYmf0zfK2eRbQJhpeYxlcOVG5a x1neW2igDiBcTXmcx8tYQr+OpRzfD0NvTO1XNnibjS5hSChYV1n/pcr1bPiH4e8hJtQY 1JOhgBewc0dbXD8sOTucKcJf956xaZkE/hANR5ncgXlMI7UWUr4jnqST4yivlnD/5wlI yZjBkFAqq42gpEzIsBgMkusveBiqOzMOlaMARDiEAFLiqSiNZ1JCOI5oGK06yCrvvcfv h9ADKCJOcCb2tjs193gh229qGlmcQ9fHPRn1eZAfA4NXbNSipH2eX8NV1zb8bycOmEiu n4yA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uYWRbN0U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69837-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x10-20020a170902ec8a00b001db43f02760si1414050plg.389.2024.02.17.04.27.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 04:27:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uYWRbN0U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69837-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 698C6283B73 for ; Sat, 17 Feb 2024 12:27:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF0266A032; Sat, 17 Feb 2024 12:27:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uYWRbN0U" 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 E24F281E; Sat, 17 Feb 2024 12:27:12 +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=1708172833; cv=none; b=b+So1pSmlP9HJM9jAyFwSWBYvUJZBfPv9x6Y41XVNiK/LzkaLAubJjNsSVkfov4vrXGsuFh3hwFZ5fJI+yO7VxPXj7e6eXB02bkBKALHrSI19Khj18P5Hq1ynTARWsv/iG7oZRAPtkhTKlLkMmMyCBItEfLSxloJTrQ1YW0gRcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708172833; c=relaxed/simple; bh=CI+mga30EQ/XT42bpPPtbFN8gfOv0yqyoO4Q2QC2UnU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=qLgv3OYJaJJkpdObvs8alIZcKAjYy1K3jvCK3GiN+QhZRpGHIgHZ4qOzUxbVTGxgBy9+51WJckgkr9X1rC1k59wnNfOvZrEtpZMBohye9eXC+ufl0WE3zH5qRRfY0+vuBStTSsGowy217bgOr3fy3OFUV6ro4byqwpw/C0mECWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uYWRbN0U; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35288C433F1; Sat, 17 Feb 2024 12:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708172832; bh=CI+mga30EQ/XT42bpPPtbFN8gfOv0yqyoO4Q2QC2UnU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uYWRbN0UXsln3U/B+qSgvZSSLiywEOyexYX7sGqT87Ev1/qMA6O0kxq4tMhALRQGy YvfPqu5+SFYI3avgq623xQJnIdyHLPHO+VP9eUOPTkxXhUxBh7fa6OJWb/V/4a4Xu8 lnziGJZFJ+5wCztv99t93ultFEqKTF/jUNk2zAL34G1ZPbOns6HHoOiNTSAoiE650q C2PG6thz8pOnwlgGbRmkPH4T9Hf2efl3EE4R37P3gO/ccG2Hm72JZhFcYll4RYTLqj 0n6TLDcoF2wsQCQoSNYm+xAA4Q/0KrVCR31kTtOVzXyqqx6/itaz2Vil2O400vbOZ5 Ls0hQoNnVXQxg== Date: Sat, 17 Feb 2024 21:27:08 +0900 From: Masami Hiramatsu (Google) To: "Masami Hiramatsu (Google)" Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH RFC 1/5] tracing/probes: Fix to search structure fields correctly Message-Id: <20240217212708.2e14a88e6c1e9733450459f6@kernel.org> In-Reply-To: <170791694361.389532.10047514554799419688.stgit@devnote2> References: <170791693437.389532.6816883363982512874.stgit@devnote2> <170791694361.389532.10047514554799419688.stgit@devnote2> X-Mailer: Sylpheed 3.7.0 (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 Let me pick this patch because this is a real bugfix. On Wed, 14 Feb 2024 22:22:23 +0900 "Masami Hiramatsu (Google)" wrote: > From: Masami Hiramatsu (Google) > > Fix to search a field from the structure which has anonymous union > correctly. > Since the reference `type` pointer was updated in the loop, the search > loop suddenly aborted where it hits an anonymous union. Thus it can not > find the field after the anonymous union. This avoids updating the > cursor `type` pointer in the loop. > > Fixes: 302db0f5b3d8 ("tracing/probes: Add a function to search a member of a struct/union") > Cc: stable@vger.kernel.org > Signed-off-by: Masami Hiramatsu (Google) > --- > kernel/trace/trace_btf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_btf.c b/kernel/trace/trace_btf.c > index ca224d53bfdc..5bbdbcbbde3c 100644 > --- a/kernel/trace/trace_btf.c > +++ b/kernel/trace/trace_btf.c > @@ -91,8 +91,8 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, > for_each_member(i, type, member) { > if (!member->name_off) { > /* Anonymous union/struct: push it for later use */ > - type = btf_type_skip_modifiers(btf, member->type, &tid); > - if (type && top < BTF_ANON_STACK_MAX) { > + if (btf_type_skip_modifiers(btf, member->type, &tid) && > + top < BTF_ANON_STACK_MAX) { > anon_stack[top].tid = tid; > anon_stack[top++].offset = > cur_offset + member->offset; > -- Masami Hiramatsu (Google)