Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Dominik Maier <dmnk@google.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org, dmnk+artist@google.com
Subject: Re: [PATCH] tracing/probes: clear dynamic data_loc on stage-2 dereference fault
Date: Fri, 27 Nov 2026 08:48:32 -0500	[thread overview]
Message-ID: <20261127084832.0944600f@gandalf.local.home> (raw)
In-Reply-To: <20261126035556.407947-1-dmnk@google.com>

On Thu, 26 Nov 2026 04:55:56 +0100
Dominik Maier <dmnk@google.com> wrote:

> diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
> index 8acc0f0..4e0c49a 100644
> --- a/kernel/trace/trace_probe_tmpl.h
> +++ b/kernel/trace/trace_probe_tmpl.h
> @@ -164,8 +164,42 @@ stage2:
>  			lval = llval;
>  			goto out;
>  		}
> -		if (ret)
> +		if (unlikely(ret)) {

I get rid of this return and handle failed reads differently, and the fix
is upstream already:

  23c8af89aac3f ("tracing/probes: Zero out faulted dereferenced fields")

-- Steve

  

> +			struct fetch_insn *next = code + 1;
> +
> +			while (next->op == FETCH_OP_DEREF ||
> +			       next->op == FETCH_OP_UDEREF ||
> +			       next->op == FETCH_OP_CPU_PTR)
> +				next++;
> +
> +			if (next->op == FETCH_OP_ST_STRING ||
> +			    next->op == FETCH_OP_ST_USTRING ||
> +			    next->op == FETCH_OP_ST_SYMSTR) {
> +				if (code + 1 == next) {
> +					s3 = next;
> +					if (dest) {
> +						u32 offs;
> +
> +						loc = *(u32 *)dest;
> +						offs = get_loc_offs(loc);
> +						*(u32 *)dest = make_data_loc(0, offs);
> +					}
> +					code = s3 + 1;
> +					goto array;
> +				}
> +				if (dest) {
> +					u32 offs = get_loc_offs(*(u32 *)dest);
> +					u32 zloc = make_data_loc(0, offs);
> +					int cnt = 1;
> +
> +					if (next[1].op == FETCH_OP_LP_ARRAY)
> +						cnt = next[1].param;
> +					for (i = 0; i < cnt; i++)
> +						((u32 *)dest)[i] = zloc;
> +				}
> +			}
>  			return ret;
> +		}
>  		llval = lval;
>  		code++;
>  	} while (1);
> 
> base-commit: ebb7a8dc1e74c705daffe11c2faf38ec2628f838


      reply	other threads:[~2026-11-27 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  3:55 [PATCH] tracing/probes: clear dynamic data_loc on stage-2 dereference fault Dominik Maier
2026-11-27 13:48 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127084832.0944600f@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=dmnk+artist@google.com \
    --cc=dmnk@google.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox