Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 486714 - app-emulation/qemu - stack overflow in virtfs-proxy-helper
Summary: app-emulation/qemu - stack overflow in virtfs-proxy-helper
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Doug Goldstein (RETIRED)
URL: https://lists.nongnu.org/archive/html...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-10-01 21:13 UTC by Tim Comer
Modified: 2014-04-20 02:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to fix stack overflow in virtfs-proxy-helper (file_486714.txt,406 bytes, patch)
2013-10-01 21:13 UTC, Tim Comer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Comer 2013-10-01 21:13:52 UTC
Created attachment 359940 [details, diff]
patch to fix stack overflow in virtfs-proxy-helper

virtfs-proxy-helper is used to create a named socket to a 9p-exported directory:
virtfs-proxy-helper --path /srv/files --socket /var/run/qemu/files.socket --uid `id -u qemu` --gid `id -g qemu`

qemu is started with:
-virtfs proxy,socket=/var/run/qemu/files.socket,security_model=proxy,mount_tag=files

when qemu connects to the named socket, proxy helper fails with:

kernel: PAX: size overflow detected in function move_addr_to_user net/socket.c:221 cicus.375_29 max, count: 51
kernel: CPU: 13 PID: 28815 Comm: virtfs-proxy-he Not tainted 3.10.1-hardened-r1 #1
kernel: Call Trace:
kernel: [<ffffffff817c630a>] ? dump_stack+0xd/0x17
kernel: [<ffffffff8114dcf5>] ? report_size_overflow+0x35/0x40
kernel: [<ffffffff816a452d>] ? move_addr_to_user+0x5d/0x2a0
kernel: [<ffffffff8175c2a0>] ? unix_peer_get+0x10/0x40
kernel: [<ffffffff8175cb29>] ? unix_getname+0x49/0xf0
kernel: [<ffffffff816a8097>] ? SyS_accept4+0x227/0x2d0
kernel: [<ffffffff817d2273>] ? system_call_fastpath+0x18/0x1d
kernel: [<ffffffff817cbe48>] ? page_fault+0x38/0x40
kernel: [<ffffffff817cbbf4>] ? retint_swapgs+0xe/0x11

Behaviour is inconsistent, but more likely to fail than not.
Code analysis suggests that the reason is a usage of an uninitialized variable to pass the size of a buffer on socket accept. Adding the proper initialization fixed the issue. Patch is attached.