kNFSD Encrypted Filehandles
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 32 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | nfsd: Convert export flags to use BIT() macrofs/ include/ | +19 | 0 replies | |
| 2/7 | nfsd: Add a symmetric-key cipher for encrypted filehandlesDocumentation/ fs/ fs/ +4 more | +88 | 0 replies | |
| 3/7 | nfsd/sunrpc: add per-thread crypto context pointerinclude/ net/ | +6 | 0 replies | |
| 4/7 | NFSD: Add a per-knfsd reusable encfh_buffs/ fs/ fs/ +7 more | +34 | 0 replies | |
| 5/7 | NFSD/export: Add encrypt_fh export optionfs/ include/ | +4 | 0 replies | |
| 6/7 | NFSD: Add filehandle crypto functions and helpersfs/ fs/ | +178 | 4 replies | |
| 7/7 | NFSD: Enable filehandle encryptionfs/ fs/ fs/ +1 more | +28 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH v1 0/7] kNFSD Encrypted Filehandles
In order to harden kNFSD against various filehandle manipulation techniques the following patches implement a method of reversibly encrypting filehandle contents.
Using the kernel's skcipher AES-CBC, filehandles are encrypted by firstly hashing the fileid using the fsid as a salt, then using the hashed fileid as the first block to finally hash the fsid.
The first attempts at this used stack-allocated buffers, but I ran into many memory alignment problems on my arm64 machine that sent me back to using GFP_KERNEL allocations (here's to you /include/linux/scatterlist.h:210). In order to avoid constant allocation/freeing, the buffers are allocated once for every knfsd thread. If anyone has suggestions for reducing the number of buffers required and their memcpy() operations, I am all ears.
Currently the code overloads filehandle's auth_type byte. This seems appropriate for this purpose, but this implementation does not actually reject unencrypted filehandles on an export that is giving out encrypted ones. I expect we'll want to tighten this up in a future version.
Comments and critique welcome.
Benjamin Coddington (7):
nfsd: Convert export flags to use BIT() macro
nfsd: Add a symmetric-key cipher for encrypted filehandles nfsd/sunrpc: add per-thread crypto context pointer
NFSD: Add a per-knfsd reusable encfh_buf NFSD/export: Add encrypt_fh export option
NFSD: Add filehandle crypto functions and helpers
NFSD: Enable filehandle encryption
Documentation/netlink/specs/nfsd.yaml | 12 ++ fs/nfsd/export.c | 7 +- fs/nfsd/localio.c | 2 +- fs/nfsd/lockd.c | 2 +- fs/nfsd/netlink.c | 15 +++ fs/nfsd/netlink.h | 1 + fs/nfsd/netns.h | 1 + fs/nfsd/nfs3proc.c | 10 +- fs/nfsd/nfs3xdr.c | 14 +- fs/nfsd/nfs4proc.c | 10 +- fs/nfsd/nfs4xdr.c | 14 +- fs/nfsd/nfsctl.c | 40 +++++- fs/nfsd/nfsfh.c | 179 +++++++++++++++++++++++++- fs/nfsd/nfsfh.h | 26 +++- fs/nfsd/nfsproc.c | 8 +- fs/nfsd/trace.h | 19 +++ include/linux/sunrpc/svc.h | 12 +- include/uapi/linux/nfsd/export.h | 36 +++--- include/uapi/linux/nfsd_netlink.h | 2 + net/sunrpc/svc.c | 1 + 20 files changed, 356 insertions(+), 55 deletions(-)
Signature · 1 line
2.50.1