* [PATCH] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key
@ 2026-09-17 4:43 Nguyen Duy Nhat Anh
0 siblings, 0 replies; 3+ messages in thread
From: Nguyen Duy Nhat Anh @ 2026-09-17 4:43 UTC (permalink / raw)
To: code
Cc: blum, rdunlap, chenyichong, zhangzekun, ebiggers, ecryptfs,
linux-kernel, syzbot+b9529ebe6a9394ddf825, Nguyen Duy Nhat Anh
Add a bounds check in ecryptfs_get_key_payload_data() to ensure the
key payload datalen is at least sizeof(struct ecryptfs_auth_tok) before
returning the pointer. This prevents out-of-bounds reads when userspace
supplies a short payload via add_key().
Reported-by: syzbot+b9529ebe6a9394ddf825@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b9529ebe6a9394ddf825
Signed-off-by: Nguyen Duy Nhat Anh <neganhat@gmail.com>
---
fs/ecryptfs/ecryptfs_kernel.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 58165928ed1e..3baccd4143e8 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -124,6 +124,9 @@ ecryptfs_get_key_payload_data(struct key *key)
if (!ukp)
return ERR_PTR(-EKEYREVOKED);
+ if (ukp->datalen < sizeof(struct ecryptfs_auth_tok))
+ return ERR_PTR(-EINVAL);
+
return (struct ecryptfs_auth_tok *)ukp->data;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key
@ 2026-09-17 4:45 Nguyen Duy Nhat Anh
2026-10-13 5:11 ` Tyler Hicks
0 siblings, 1 reply; 3+ messages in thread
From: Nguyen Duy Nhat Anh @ 2026-09-17 4:45 UTC (permalink / raw)
To: code
Cc: blum, rdunlap, chenyichong, zhangzekun, ebiggers, ecryptfs,
linux-kernel, syzbot+b9529ebe6a9394ddf825, Nguyen Duy Nhat Anh
Add a bounds check in ecryptfs_get_key_payload_data() to ensure the
key payload datalen is at least sizeof(struct ecryptfs_auth_tok) before
returning the pointer. This prevents out-of-bounds reads when userspace
supplies a short payload via add_key().
Reported-by: syzbot+b9529ebe6a9394ddf825@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b9529ebe6a9394ddf825
Signed-off-by: Nguyen Duy Nhat Anh <neganhat@gmail.com>
---
fs/ecryptfs/ecryptfs_kernel.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 58165928ed1e..3baccd4143e8 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -124,6 +124,9 @@ ecryptfs_get_key_payload_data(struct key *key)
if (!ukp)
return ERR_PTR(-EKEYREVOKED);
+ if (ukp->datalen < sizeof(struct ecryptfs_auth_tok))
+ return ERR_PTR(-EINVAL);
+
return (struct ecryptfs_auth_tok *)ukp->data;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key
2026-09-17 4:45 Nguyen Duy Nhat Anh
@ 2026-10-13 5:11 ` Tyler Hicks
0 siblings, 0 replies; 3+ messages in thread
From: Tyler Hicks @ 2026-10-13 5:11 UTC (permalink / raw)
To: Nguyen Duy Nhat Anh
Cc: blum, rdunlap, chenyichong, zhangzekun, ebiggers, ecryptfs,
linux-kernel, syzbot+b9529ebe6a9394ddf825
On Thu, 17 Sep 2026 11:45:58 +0700, Nguyen Duy Nhat Anh wrote:
> Add a bounds check in ecryptfs_get_key_payload_data() to ensure the
> key payload datalen is at least sizeof(struct ecryptfs_auth_tok) before
> returning the pointer. This prevents out-of-bounds reads when userspace
> supplies a short payload via add_key().
Thank you! This has been applied to the next branch of the tyhicks/ecryptfs.git tree.
I added a handful of additional git commit tags, such as:
Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig")
Cc: stable@vger.kernel.org
...
Reported-by: syzbot+e4391e0d6e7c89b8c84e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e4391e0d6e7c89b8c84e
Reported-by: syzbot+dc50906b100ac7a1c34d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=dc50906b100ac7a1c34d
You can find a direct link below but please be aware that the commit hash is
unstable and, therefore, the URL may not be valid in the future.
[1/1] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key
https://git.kernel.org/tyhicks/ecryptfs/c/5b00bf0f3b7ad05eff79b84e3bacf3f98ac67dc6
Tyler
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 5:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 4:43 [PATCH] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key Nguyen Duy Nhat Anh
-- strict thread matches above, loose matches on Subject: below --
2026-09-17 4:45 Nguyen Duy Nhat Anh
2026-10-13 5:11 ` Tyler Hicks
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.