Received: from eggs.gnu.org ([2001:4830:134:3::10]:57239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFmvp-0001Lh-L9 for qemu-devel@nongnu.org; Thu, 16 Jul 2015 13:26:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFmvo-00015J-Jj for qemu-devel@nongnu.org; Thu, 16 Jul 2015 13:26:49 -0400 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <20150716131928.GB16984@stefanha-thinkpad.redhat.com> Date: Thu, 16 Jul 2015 13:26:36 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <14A73803-9890-4DF0-B2D0-D30A26C73213@gmail.com> References: <20150709105213.GE28530@stefanha-thinkpad.redhat.com> <6FA64178-06AB-4C41-9A90-6FCD8ADF0CE4@gmail.com> <20150716131928.GB16984@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] raw-posix.c: Make physical devices usable in QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel qemu-devel , Qemu-block On Jul 16, 2015, at 9:19 AM, Stefan Hajnoczi wrote: > On Thu, Jul 09, 2015 at 10:02:26AM -0400, Programmingkid wrote: >>=20 >> On Jul 9, 2015, at 6:52 AM, Stefan Hajnoczi wrote: >>=20 >>> On Tue, Jul 07, 2015 at 01:33:23PM -0400, Programmingkid wrote: >>>> Make physical devices like a USB flash drive or a CDROM drive work = in QEMU. With >>>> this patch I can use a USB flash drive like a hard drive. Before = this patch,=20 >>>> QEMU would just quit with a message like "resource busy". >>>=20 >>> The commit message and the description are missing "on Mac OS X". = It >>> should be clear right away that this applies to Mac only. This = works >>> fine on Linux and probably other host OSes. >>=20 >> Yeah, that should have been done. Did you see any issues with the = code? >=20 > QEMU shouldn't silently open a different file than the one given by = the > user. The user should give the exact device file they want. If there > is magic behavior it needs to be documented, but I don't see a reason > why that's necessary in the case of device files. I think you are reviewing an older patch. The newest one doesn't do = that.=20 >=20 > QEMU shouldn't mount/unmount the CD-ROM. atexit(3) doesn't handle > crashes or abort(). Users may be confused to find their CD-ROM > unmounted in those cases and would see this as a bug. Instead we = should > refuse mounted CD-ROMs so the user understands that block-level access > requires them to unmount first. That can be done. It just wouldn't be as user friendly as having QEMU do = it for the user :( >=20 > The strcpy/sprintf usage in this patch is unsafe and can lead to = buffer > overflow, for example in the case of generating command-lines. The > command-line buffer is only MAXPATHLEN so prepending the command to = the > filename could exceed the buffer size. >=20 > There is also a buffer overflow in the array of devices that need to = be > mounted. What happens if there are more than 7 devices? Ok. Will correct this issue.=20