[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 046/111] virtiofsd: prevent ".." escape in lo_do_lookup()
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 046/111] virtiofsd: prevent ".." escape in lo_do_lookup() |
Date: |
Thu, 23 Jan 2020 11:57:36 +0000 |
From: Stefan Hajnoczi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
tools/virtiofsd/passthrough_ll.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index e375406160..79d5966eea 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -624,12 +624,17 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t
parent, const char *name,
int res;
int saverr;
struct lo_data *lo = lo_data(req);
- struct lo_inode *inode;
+ struct lo_inode *inode, *dir = lo_inode(req, parent);
memset(e, 0, sizeof(*e));
e->attr_timeout = lo->timeout;
e->entry_timeout = lo->timeout;
+ /* Do not allow escaping root directory */
+ if (dir == &lo->root && strcmp(name, "..") == 0) {
+ name = ".";
+ }
+
newfd = openat(lo_fd(req, parent), name, O_PATH | O_NOFOLLOW);
if (newfd == -1) {
goto out_err;
--
2.24.1
- [PULL 037/111] virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers, (continued)
- [PULL 037/111] virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 038/111] virtiofsd: passthrough_ll: add fd_map to hide file descriptors, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 036/111] virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 042/111] virtiofsd: Pass write iov's all the way through, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 043/111] virtiofsd: add fuse_mbuf_iter API, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 040/111] virtiofsd: validate path components, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 041/111] virtiofsd: Plumb fuse_bufvec through to do_write_buf, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 039/111] virtiofsd: passthrough_ll: add fallback for racy ops, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 044/111] virtiofsd: validate input buffer sizes in do_write_buf(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 047/111] virtiofsd: prevent ".." escape in lo_do_readdir(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 046/111] virtiofsd: prevent ".." escape in lo_do_lookup(),
Dr. David Alan Gilbert (git) <=
- [PULL 048/111] virtiofsd: use /proc/self/fd/ O_PATH file descriptor, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 049/111] virtiofsd: sandbox mount namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 053/111] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 052/111] virtiofsd: add seccomp whitelist, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 045/111] virtiofsd: check input buffer size in fuse_lowlevel.c ops, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 051/111] virtiofsd: move to a new pid namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 054/111] virtiofsd: cap-ng helpers, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 050/111] virtiofsd: move to an empty network namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 055/111] virtiofsd: Drop CAP_FSETID if client asked for it, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 057/111] virtiofsd: fix libfuse information leaks, Dr. David Alan Gilbert (git), 2020/01/23