All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Mykyta Yatsenko <yatsenko@meta.com>
Cc: bpf@vger.kernel.org
Subject: [bug report] bpf: Implement dynptr copy kfuncs
Date: Fri, 23 May 2025 18:58:58 +0300	[thread overview]
Message-ID: <aDCbQq99EfNDI8xr@stanley.mountain> (raw)

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

             reply	other threads:[~2025-05-23 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 15:58 Dan Carpenter [this message]
2025-05-23 16:10 ` [bug report] bpf: Implement dynptr copy kfuncs Mykyta Yatsenko

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=aDCbQq99EfNDI8xr@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=bpf@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.