[PATCH v4 0/2] proc,fcntl: introduce F_SET_DESCRIPTION

2020-08-13 Thread Pascal Bouchareine
This is a first attempt at taking Alexey's comments into account This goes against v5.8 tl;dr in commit 2/2 but motivation is also described a bit in https://lore.kernel.org/linux-api/CAGbU3_nVvuzMn2wo4_ZKufWcGfmGsopVujzTWw-Bbeky=xs...@mail.gmail.com/

[PATCH v4 2/2] fcntl: introduce F_SET_DESCRIPTION

2020-08-13 Thread Pascal Bouchareine
-by: Pascal Bouchareine --- fs/fcntl.c | 21 + fs/file_table.c| 2 ++ fs/proc/fd.c | 5 + include/linux/fs.h | 3 +++ include/uapi/linux/fcntl.h | 5 + 5 files changed, 36 insertions(+) diff --git a/fs/fcntl.c b/fs/fcntl.c

[PATCH v4 1/2] mm: add GFP mask param to strndup_user

2020-08-13 Thread Pascal Bouchareine
Let caller specify allocation. Keep the existing calls with GFP_USER, and enforce the existing defense against log spam from userspace with __GFP_NOWARN. Signed-off-by: Pascal Bouchareine --- drivers/dma-buf/dma-buf.c | 2 +- drivers/gpu/drm/i915/i915_debugfs_params.c | 2

Re: [PATCH v4 2/2] fcntl: introduce F_SET_DESCRIPTION

2020-08-13 Thread Pascal Bouchareine
On Thu, Aug 13, 2020 at 10:28 PM Christoph Hellwig wrote: > > One intended usage is to allow processes to self-document sockets > > for netstat and friends to report > > NAK. There is no way we're going to bloat a criticial structure like > struct file for some vanity information like this. The

[PATCH v2 1/2] mm: add GFP mask param to strndup_user

2020-08-21 Thread Pascal Bouchareine
Let caller specify allocation. Preserve existing calls with GFP_USER. Signed-off-by: Pascal Bouchareine --- Updating patch 1/ and 2/ to address comments drivers/dma-buf/dma-buf.c | 2 +- drivers/gpu/drm/i915/i915_debugfs_params.c | 2 +- drivers/gpu/drm/vc4/vc4_bo.c

[PATCH v2 2/2] net: socket: implement SO_DESCRIPTION

2020-08-21 Thread Pascal Bouchareine
ignore optlen and constrain the string to a static max size Signed-off-by: Pascal Bouchareine --- include/net/sock.h| 4 +++ include/uapi/asm-generic/socket.h | 2 ++ net/core/sock.c | 53 +++ net/socket.c | 5

Re: [PATCH v2 1/2] mm: add GFP mask param to strndup_user

2020-08-22 Thread Pascal Bouchareine
Thanks for taking a look! On Fri, Aug 21, 2020 at 8:51 PM Andrew Morton wrote: > Why change all existing callsites so that one callsite can pass in a > different gfp_t? My initial thought was to change strndup_user to use GFP_KERNEL_ACCOUNT (or GFP_USER | __GFP_ACCOUNT ?) unconditionally.

Re: [PATCH v2 2/2] net: socket: implement SO_DESCRIPTION

2020-08-22 Thread Pascal Bouchareine
Thank you, On Sat, Aug 22, 2020 at 12:36 PM David Miller wrote: > > We ignore optlen and constrain the string to a static max size > > > > Signed-off-by: Pascal Bouchareine > > This change is really a non-starter unless the information gets > published somewhere

Re: [PATCH v2 2/2] net: socket: implement SO_DESCRIPTION

2020-08-22 Thread Pascal Bouchareine
On Sat, Aug 22, 2020 at 12:59 PM Pascal Bouchareine wrote: > Would it make sense to also make UDIAG_SHOW_NAME use sk_description? > (And keep the existing change - setsockopt + show_fd_info via > /proc/.../fdinfo/..) Ah,very wrong example - to be more precise, I suppose that'd

Re: [PATCH v2 2/2] net: socket: implement SO_DESCRIPTION

2020-08-22 Thread Pascal Bouchareine
On Sat, Aug 22, 2020 at 1:19 PM Pascal Bouchareine wrote: > > On Sat, Aug 22, 2020 at 12:59 PM Pascal Bouchareine wrote: > > > Would it make sense to also make UDIAG_SHOW_NAME use sk_description? > > (And keep the existing change - setsockopt + show_fd_info via > > /p

Re: [PATCH v2 2/2] net: socket: implement SO_DESCRIPTION

2020-08-23 Thread Pascal Bouchareine
On Sat, Aug 22, 2020 at 2:01 PM David Miller wrote: > > About the pid part - > > On top of multiple pids to scan for a given socket, there's also the > > security provided by /proc - I'm not sure what inet_diag does for that > > So maybe users calling it will need to scan /proc for a long time

[RFC PATCH 0/2] proc,socket: attach description to sockets

2020-08-15 Thread Pascal Bouchareine
Checking to see if this could fit in struct sock. This goes against v5.8 I tried to make it tl;dr in commit 2/2 but motivation is also described a bit in https://lore.kernel.org/linux-api/CAGbU3_nVvuzMn2wo4_ZKufWcGfmGsopVujzTWw-Bbeky=xs...@mail.gmail.com/

[PATCH 2/2] net: socket: implement SO_DESCRIPTION

2020-08-15 Thread Pascal Bouchareine
ignore optlen and constrain the string to a static max size Signed-off-by: Pascal Bouchareine --- include/net/sock.h| 4 include/uapi/asm-generic/socket.h | 2 ++ net/core/sock.c | 23 +++ net/socket.c | 5 + 4

[PATCH 1/2] mm: add GFP mask param to strndup_user

2020-08-15 Thread Pascal Bouchareine
Let caller specify allocation. Preserve existing calls with GFP_USER. Signed-off-by: Pascal Bouchareine --- drivers/dma-buf/dma-buf.c | 2 +- drivers/gpu/drm/i915/i915_debugfs_params.c | 2 +- drivers/gpu/drm/vc4/vc4_bo.c | 3 +- drivers/input/misc/uinput.c

Re: [PATCH 2/2] net: socket: implement SO_DESCRIPTION

2020-08-16 Thread Pascal Bouchareine
On Sun, Aug 16, 2020 at 11:15 AM Eric Dumazet wrote: > > 1) You also ignored what would happen at accept() time. > > Please test your patches with ASAN. Ouch, I will look into it - thanks for pointing that out & 3/ > > 2) Also, why is that description specific to sockets ? fcntl on struct file

[PATCH] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
-by: Pascal Bouchareine --- More context sent earlier this week: https://lore.kernel.org/linux-api/CAGbU3_nVvuzMn2wo4_ZKufWcGfmGsopVujzTWw-Bbeky=xs...@mail.gmail.com/T/#u Documentation/filesystems/proc.rst | 3 +++ fs/fcntl.c | 19 +++ fs/proc/fd.c

Re: [PATCH] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
On Sat, Jul 25, 2020 at 3:10 PM Al Viro wrote: > Have you even tried to test it? When will it ever free those things? Thanks for pointing that out, I'll try to address that in the thread I did basic tests against 5.4: set a description, concurrently set it from multiple child processes, read,

[PATCH v2] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
-by: Pascal Bouchareine --- Documentation/filesystems/proc.rst | 3 +++ fs/fcntl.c | 19 +++ fs/file_table.c| 3 +++ fs/proc/fd.c | 5 + include/linux/fs.h | 3 +++ include/uapi/linux/fcntl.h

[PATCH v3] This command attaches a description to a file descriptor for troubleshooting purposes. The free string is displayed in the process fdinfo file for that fd /proc/pid/fdinfo/fd.

2020-07-25 Thread Pascal Bouchareine
One intended usage is to allow processes to self-document sockets for netstat and friends to report Signed-off-by: Pascal Bouchareine --- Documentation/filesystems/proc.rst | 3 +++ fs/fcntl.c | 19 +++ fs/file_table.c| 2 ++ fs/proc

[PATCH v3] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
-by: Pascal Bouchareine --- Documentation/filesystems/proc.rst | 3 +++ fs/fcntl.c | 19 +++ fs/file_table.c| 2 ++ fs/proc/fd.c | 5 + include/linux/fs.h | 3 +++ include/uapi/linux/fcntl.h

Re: [PATCH v3] This command attaches a description to a file descriptor for troubleshooting purposes. The free string is displayed in the process fdinfo file for that fd /proc/pid/fdinfo/fd.

2020-07-25 Thread Pascal Bouchareine
Sorry about all the noise, please disregard this one. On Sat, Jul 25, 2020 at 7:04 PM Pascal Bouchareine wrote: > > One intended usage is to allow processes to self-document sockets > for netstat and friends to report > > Signed-off-by: Pascal Bouchareine > --- > Docu

Re: [PATCH v3] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-27 Thread Pascal Bouchareine
Thanks for reviewing, I added some questions inline below On Mon, Jul 27, 2020 at 7:21 AM Alexey Dobriyan wrote: > > + d = strndup_user(desc, MAX_FILE_DESC_SIZE); > > This should be kmem accounted because allocation is persistent. > To make things more entertaining, strndup_user() doesn't

Re: [PATCH v3] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-28 Thread Pascal Bouchareine
On Mon, Jul 27, 2020 at 6:39 PM Pascal Bouchareine wrote: > > struct file is nicely aligned to 256 bytes on distro configs. > > Will this break everything? > > > > $ cat /sys/kernel/slab/filp/object_size > > Indeed on the config I'm using here this