Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
qemu.12241
0108-9p-fix-QEMU-crash-when-renaming-fil.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0108-9p-fix-QEMU-crash-when-renaming-fil.patch of Package qemu.12241
From c41815b1728d3597f8657fc70eef57be31bcad0c Mon Sep 17 00:00:00 2001 From: Greg Kurz <groug@kaod.org> Date: Fri, 23 Nov 2018 13:28:03 +0100 Subject: [PATCH] 9p: fix QEMU crash when renaming files When using the 9P2000.u version of the protocol, the following shell command line in the guest can cause QEMU to crash: while true; do rm -rf aa; mkdir -p a/b & touch a/b/c & mv a aa; done With 9P2000.u, file renaming is handled by the WSTAT command. The v9fs_wstat() function calls v9fs_complete_rename(), which calls v9fs_fix_path() for every fid whose path is affected by the change. The involved calls to v9fs_path_copy() may race with any other access to the fid path performed by some worker thread, causing a crash like shown below: Thread 12 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x0000555555a25da2 in local_open_nofollow (fs_ctx=0x555557d958b8, path=0x0, flags=65536, mode=0) at hw/9pfs/9p-local.c:59 59 while (*path && fd != -1) { (gdb) bt path=0x0, flags=65536, mode=0) at hw/9pfs/9p-local.c:59 path=0x0) at hw/9pfs/9p-local.c:92 fs_path=0x555556b56858, stbuf=0x7fff84830ef0) at hw/9pfs/9p-local.c:185 path=0x555556b56858, stbuf=0x7fff84830ef0) at hw/9pfs/cofile.c:53 at hw/9pfs/9p.c:1083 at util/coroutine-ucontext.c:116 (gdb) The fix is to take the path write lock when calling v9fs_complete_rename(), like in v9fs_rename(). Impact: DoS triggered by unprivileged guest users. Fixes: CVE-2018-19489 Cc: P J P <ppandit@redhat.com> Reported-by: zhibin hu <noirfate@gmail.com> Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Greg Kurz <groug@kaod.org> (cherry picked from commit 1d20398694a3b67a388d955b7a945ba4aa90a8a8) [BR: BSC#1117275] Signed-off-by: Bruce Rogers <brogers@suse.com> --- hw/9pfs/9p.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 52d46632fe..9d12bc6332 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2808,6 +2808,7 @@ static void coroutine_fn v9fs_wstat(void *opaque) struct stat stbuf; V9fsFidState *fidp; V9fsPDU *pdu = opaque; + V9fsState *s = pdu->s; v9fs_stat_init(&v9stat); err = pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat); @@ -2873,7 +2874,9 @@ static void coroutine_fn v9fs_wstat(void *opaque) } } if (v9stat.name.size != 0) { + v9fs_path_write_lock(s); err = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name); + v9fs_path_unlock(s); if (err < 0) { goto out; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor