Kernel TLS

Valentin Vidić vvidic at valentin-vidic.from.hr
Fri Nov 29 14:48:01 EST 2019


On Fri, Nov 29, 2019 at 02:36:10PM -0500, Jeffrey Walton wrote:
> I'm trying to run through the example at
> https://www.kernel.org/doc/html/latest/networking/tls.html#kernel-tls
> .
> 
> I'm working on Fedora 31 x86_64 (fully patched). Running my program results in:
> 
>     $ ./ktls
>     setsockopt failed, 2, No such file or directory
> 
> I observed:
> 
>     $ cat /proc/sys/net/ipv4/tcp_available_ulp
>     $
> 
> Is there a way to enable ULP at boot? Or is this a kernel config
> option? Or maybe I am doing something else wrong?

strace gives me:

...
socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_TCP, TCP_ULP, [7564404], 4) = -1 ENOENT (No such file or directory)
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x2), ...}) = 0
brk(NULL)                               = 0x55d76b14e000
brk(0x55d76b16f000)                     = 0x55d76b16f000
write(1, "setsockopt failed, 2, No such fi"..., 48setsockopt failed, 2, No such file or directory
) = 48
exit_group(1)                           = ?
+++ exited with 1 +++

$ grep TLS /boot/config-4.19.0-6-amd64 
CONFIG_HAVE_COPY_THREAD_TLS=y
# CONFIG_TLS is not set
# CONFIG_VIDEO_IVTV_DEPRECATED_IOCTLS is not set

So you probably need to rebuild the kernel with CONFIG_TLS to get this working.

-- 
Valentin



More information about the Kernelnewbies mailing list