Adding an in-kernel TLS handshake
Adding an in-kernel TLS handshake
Posted Jun 2, 2022 18:50 UTC (Thu) by jlayton (subscriber, #31672)In reply to: Adding an in-kernel TLS handshake by james
Parent article: Adding an in-kernel TLS handshake
I agree that a userland implementation is definitely the way to go. We may need the daemon to be extra careful to avoid allocations in critical codepaths, which may be difficult depending on what the TLS libraries do under the hood.
Posted Jun 3, 2022 0:54 UTC (Fri)
by NYKevin (subscriber, #129325)
[Link] (3 responses)
But OTOH neither the man pages nor POSIX are very clear about what EIO even means or how userspace should react to it, so I imagine there are some applications that will freak out and do weird things if you return that error. Amazingly, POSIX does not even tell you what the state of the file descriptor is after close(2) fails with EIO, which means you have no way of knowing (assuming a POSIX-only environment that lacks /proc/self/fd) whether the file descriptor still exists and still needs to be closed! I guess the only safe way is to loop and repeatedly call close until you get EBADF? But that's obviously not thread-safe, and I could imagine a brain-dead implementation that just keeps returning EIO and never deallocates the fd.
Posted Jun 3, 2022 14:27 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (1 responses)
Have you *looked* at what happens to data once the write() call returns? The reality is that the kernel doesn't have a clue which application needs to be told, nor how to tell it.
It gets even worse once network/raid/luks/integrity/blahblah gets involved. As a simple example, let's say you're writing a file of one block to a ten-disk raid array. You need to read 40k from disk, recompute checksums, and write the whole lot back. If THAT goes wrong, how do you tell the application it just trashed some data that was written six months ago ... ?
Okay, that's a bit extreme, but once the application has launched the data on its journey to disk, it's very hard to work out some sane way to pass an error back up the unpredictable path the data has taken.
Cheers,
Posted Jun 3, 2022 15:50 UTC (Fri)
by jlayton (subscriber, #31672)
[Link]
Not true, at least not on modern kernels. We track writeback errors in a better way now such that if we get one, it's reported exactly once to fsync/msync on every fd that was open at the time that the error was recorded. Ditto for syncfs(2).
Posted Jun 3, 2022 15:45 UTC (Fri)
by jlayton (subscriber, #31672)
[Link]
Adding an in-kernel TLS handshake
Adding an in-kernel TLS handshake
Wol
Adding an in-kernel TLS handshake
Adding an in-kernel TLS handshake