public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Mykyta Yatsenko <yatsenko@meta.com>
Cc: bpf@vger.kernel.org
Subject: Re: [bug report] bpf: Implement dynptr copy kfuncs
Date: Fri, 23 May 2025 17:10:10 +0100	[thread overview]
Message-ID: <1d6a8908-01dd-4285-989c-0d7a6b4dbfd5@gmail.com> (raw)
In-Reply-To: <aDCbQq99EfNDI8xr@stanley.mountain>

On 5/23/25 16:58, Dan Carpenter wrote:
> Hello Mykyta Yatsenko,
>
> Commit a498ee7576de ("bpf: Implement dynptr copy kfuncs") from May
> 12, 2025 (linux-next), leads to the following Smatch static checker
> warning:
>
> 	kernel/trace/bpf_trace.c:3557 copy_user_data_sleepable()
> 	warn: maybe return -EFAULT instead of the bytes remaining?
>
> kernel/trace/bpf_trace.c
>      3551 static __always_inline int copy_user_data_sleepable(void *dst, const void *unsafe_src,
>      3552                                                     u32 size, struct task_struct *tsk)
>      3553 {
>      3554         int ret;
>      3555
>      3556         if (!tsk) /* Read from the current task */
> --> 3557                 return copy_from_user(dst, (const void __user *)unsafe_src, size);
>
> I don't know if it matters what we return here so long as it's non-zero.
> This is probably a fast path so maybe we're returning positives
> intentionally?
>
>      3558
>      3559         ret = access_process_vm(tsk, (unsigned long)unsafe_src, dst, size, 0);
>      3560         if (ret != size)
>      3561                 return -EFAULT;
>      3562         return 0;
>      3563 }
>
> regards,
> dan carpenter
>
Hi, thanks for the report, I think the warning is right, let me send the 
fix a bit later today.

      reply	other threads:[~2025-05-23 16:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 15:58 [bug report] bpf: Implement dynptr copy kfuncs Dan Carpenter
2025-05-23 16:10 ` Mykyta Yatsenko [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=1d6a8908-01dd-4285-989c-0d7a6b4dbfd5@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=yatsenko@meta.com \
    /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