Thread (4 messages) 4 messages, 2 authors, 2026-03-30

Re: [PATCH v2 1/2] iov: Bypass usercopy hardening for copy_to_iter()

From: David Laight <hidden>
Date: 2026-03-30 21:11:35
Also in: linux-block, linux-fsdevel, linux-hardening

On Mon, 30 Mar 2026 10:36:30 -0400
Chuck Lever [off-list ref] wrote:
From: Chuck Lever <redacted>

Profiling NFSD under an iozone workload showed that hardened
usercopy checks consume roughly 1.3% of CPU in the TCP receive
path. The runtime check in check_object_size() validates that
copy buffers reside in expected kernel memory regions (slab,
stack, and non-text), which is meaningful when data crosses
the user/kernel boundary but adds no value when both source
and destination are kernel addresses.
I thought the purpose was to avoid accidental overwrites when
the allocated buffer was the wrong size.
This is pretty much likely to affect user copies as kernel ones.

OTOH the overhead for some socket paths is really horrid.
IIRC sendmsg/recvmsg does copies where the length depends on
whether it is a 64bit or compat system call.
These go through the full horrors of user copy hardening even
thought there is no way they can ever fail.
That is the 'control pane' copies - well before you get to
any actual data.

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help