From: Matthew Wilcox > Sent: 16 May 2020 16:37 ... > > Basically: > > > > This patch sequence (to be written) does the following: > > > > Patch 1: Change __sys_setsockopt() to allocate a kernel buffer, > > copy the data into it then call set_fs(KERNEL_DS). > > An on-stack buffer (say 64 bytes) will be used for > > small transfers. > > > > Patch 2: The same for __sys_getsockopt(). > > > > Patch 3: Compat setsockopt. > > > > Patch 4: Compat getsockopt. > > > > Patch 5: Remove the user copies from the global socket options code. > > > > Patches 6 to n-1; Remove the user copies from the per-protocol code. > > > > Patch n: Remove the set_fs(KERNEL_DS) from the entry points. > > > > This should be bisectable. > > I appreciate your dedication to not publishing the source code to > your kernel module, but Christoph's patch series is actually better. > It's typesafe rather than passing void pointers around. There are plenty on interfaces that pass a 'pointer and length'. Having the compiler do a type check doesn't give any security benefit - just stops silly errors. Oh yes, I've attached the only driver source file that calls into the Linux kernel. You are perfectly free to look at all the thing we have to do to support different and broken kernel releases. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)