[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iK0QOCDyEZS2z4Z_VZSqkDWO6kcFZ+b3ah+CVyyK-5x6A@mail.gmail.com>
Date: Fri, 16 Apr 2021 20:28:40 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Soheil Hassas Yeganeh <soheil@...gle.com>
Subject: Re: [PATCH net-next] scm: optimize put_cmsg()
On Fri, Apr 16, 2021 at 7:57 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Thu, 15 Apr 2021 10:37:53 -0700 Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com>
> >
> > Calling two copy_to_user() for very small regions has very high overhead.
> >
> > Switch to inlined unsafe_put_user() to save one stac/clac sequence,
> > and avoid copy_to_user().
> >
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > Cc: Soheil Hassas Yeganeh <soheil@...gle.com>
>
> Hi Eric!
>
> This appears to break boot on my systems.
>
> IDK how exactly, looks like systemd gets stuck waiting for nondescript
> services to start in initramfs. I have lots of debug enabled and didn't
> spot anything of note in kernel logs.
>
> I'll try to poke at this more, but LMK if you have any ideas. The
> commit looks "obviously correct" :S
Oops, my rebase went wong, sorry for that
Can you check this patch (on top of the buggy one) ?
If that works, I'll submit a v2
diff --git a/net/core/scm.c b/net/core/scm.c
index bd96c922041d22a2f3b7ee73e4b3183316f9b616..ae3085d9aae8adb81d3bb42c8a915a205476a0ee
100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -232,7 +232,7 @@ int put_cmsg(struct msghdr * msg, int level, int
type, int len, void *data)
if (!user_write_access_begin(cm, cmlen))
goto efault;
- unsafe_put_user(len, &cm->cmsg_len, efault_end);
+ unsafe_put_user(cmlen, &cm->cmsg_len, efault_end);
unsafe_put_user(level, &cm->cmsg_level, efault_end);
unsafe_put_user(type, &cm->cmsg_type, efault_end);
unsafe_copy_to_user(CMSG_USER_DATA(cm), data,
Powered by blists - more mailing lists