Sashiko discussions
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: Jens Remus <jremus@linux.ibm.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	bpf@vger.kernel.org, sashiko@lists.linux.dev,
	Indu Bhagat <ibhagatgnu@gmail.com>
Subject: Re: [PATCH v14 04/19] x86/uaccess: Add unsafe_copy_from_user() implementation
Date: Wed, 6 May 2026 11:05:57 -0400	[thread overview]
Message-ID: <20260506110557.46ee72c3@fedora> (raw)
In-Reply-To: <2946bcda-321d-4a17-88f2-02c5137676cf@linux.ibm.com>

On Wed, 6 May 2026 16:13:25 +0200
Jens Remus <jremus@linux.ibm.com> wrote:

> > Regarding the variable naming in the updated unsafe_copy_to_user() and the
> > new unsafe_copy_from_user() macros, is there a risk of variable shadowing?
> > 
> > The macros declare local variables with very common names, specifically __dst,
> > __src, and __len. If a caller passes an argument that happens to share one of
> > these names, the local variable declaration will shadow the caller's argument.
> > For instance, if a caller passes __len, the initialization size_t __len =
> > (_len); will evaluate the right-hand side as the newly declared uninitialized
> > local variable itself. Could this lead to the loop copying a random length of
> > memory based on stack garbage instead of the intended length? The previous
> > implementation seemed to avoid this by using uniquely prefixed names like
> > __ucu_len.  
> 
> Please advise.

There is an effort to get rid of common variable names in macros that
start with underscores. But honestly, that can be dealt with later, as
it's a problem with other macros in this header.

Feel free to ignore this suggestion.

-- Steve

      reply	other threads:[~2026-05-06 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260505121718.3572346-5-jremus@linux.ibm.com>
     [not found] ` <20260505182244.0A151C2BCB4@smtp.kernel.org>
2026-05-06 14:13   ` [PATCH v14 04/19] x86/uaccess: Add unsafe_copy_from_user() implementation Jens Remus
2026-05-06 15:05     ` 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=20260506110557.46ee72c3@fedora \
    --to=rostedt@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=ibhagatgnu@gmail.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=sashiko@lists.linux.dev \
    /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