Skip to content

Some buffer management fixes for proc

Josef Bacik linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6proc: use vmalloc for our kernel bufferfs/proc/proc_sysctl.c include/linux/string.h mm/util.c+31 -31 reply
2/6tree-wide: rename vmemdup_user to kvmemdup_userarch/x86/kvm/cpuid.c drivers/gpu/drm/virtio/virtgpu_ioctl.c drivers/tty/vt/consolemap.c +4 more+13 -131 reply
3/6proc: allocate count + 1 for our read bufferfs/proc/proc_sysctl.c+23 -11 reply
4/6sysctl: make proc_put_long() use scnprintfkernel/sysctl.c+5 -101 reply
5/6parport: rework procfs handlers to take advantage of the new bufferdrivers/parport/procfs.c+36 -721 reply
6/6sunrpc: rework proc handlers to take advantage of the new buffernet/sunrpc/sysctl.c net/sunrpc/xprtrdma/svc_rdma.c+4 -221 reply

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] Some buffer management fixes for proc

This initialy started with

[PATCH 1/6] proc: use vmalloc for our kernel buffer

Which came about because we were getting page alloc failures when cat tried to do a read with a 64kib buffer, triggering an order 4 allocation. We need to switch to kvmalloc for this buffer to avoid these high order allocations. Then Christoph suggested renaming vmemdup_user to kvmemdup_user, so then we have this

[PATCH 2/6] tree-wide: rename vmemdup_user to kvmemdup_user

And then finally Viro noticed that if we allocate an extra byte for the NULL terminator then we can use scnprintf() in a few places, and thus the next set of patches

[PATCH 3/6] proc: allocate count + 1 for our read buffer [PATCH 4/6] sysctl: make proc_put_long() use scnprintf [PATCH 5/6] parport: rework procfs handlers to take advantage of the [PATCH 6/6] sunrpc: rework proc handlers to take advantage of the new

There's one case that I didn't convert, _proc_do_string, and that's because it's one of the few places that takes into account ppos, and so we'll skip forward in the string we're provided with from the caller. In this case it makes sense to just leave it the way it is. I'm pretty sure I caught all the other people who directly mess with the buffer, but there's around 800 ->proc_handler's, and my eyes started to glaze over after a while.

Josef