From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXjm6-0003sZ-Dv for qemu-devel@nongnu.org; Tue, 26 Jun 2018 04:56:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXjm5-0007Sx-JI for qemu-devel@nongnu.org; Tue, 26 Jun 2018 04:56:34 -0400 Date: Tue, 26 Jun 2018 10:56:25 +0200 From: Cornelia Huck Message-ID: <20180626105625.2396944a.cohuck@redhat.com> In-Reply-To: <79c0775f-49b5-1d79-a4f9-234941854e4f@redhat.com> References: <1529056145-6404-1-git-send-email-thuth@redhat.com> <20180626104001.617d4ea9.cohuck@redhat.com> <79c0775f-49b5-1d79-a4f9-234941854e4f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH v3] loader: Check access size when calling rom_ptr() to avoid crashes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: Peter Maydell , qemu-trivial@nongnu.org, Mark Cave-Ayland , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Artyom Tarasenko , Paolo Bonzini , Yongbok Kim , Aurelien Jarno On Tue, 26 Jun 2018 10:55:09 +0200 Thomas Huth wrote: > On 26.06.2018 10:40, Cornelia Huck wrote: > > On Fri, 15 Jun 2018 11:49:05 +0200 > > Thomas Huth wrote: > > > >> The rom_ptr() function allows direct access to the ROM blobs that we > >> load during startup. However, there are currently no checks for the > >> size of the accesses, so it's currently possible to crash QEMU for > >> example with: > >> > >> $ echo "Insane in the mainframe" > /tmp/test.txt > >> $ s390x-softmmu/qemu-system-s390x -kernel /tmp/test.txt -append xyz > >> Segmentation fault (core dumped) > >> $ s390x-softmmu/qemu-system-s390x -kernel /tmp/test.txt -initrd /tmp/test.txt > >> Segmentation fault (core dumped) > >> $ echo -n HdrS > /tmp/hdr.txt > >> $ sparc64-softmmu/qemu-system-sparc64 -kernel /tmp/hdr.txt -initrd /tmp/hdr.txt > >> Segmentation fault (core dumped) > >> > >> We need a possibility to check the size of the ROM area that we want > >> to access, thus let's add a size parameter to the rom_ptr() function > >> to avoid these problems. > >> > >> Signed-off-by: Thomas Huth > > > > Grmpf, this conflicts with "s390/ipl: fix ipl with -no-reboot" in > > s390-next... do you want to rebase it? > > Really? Where is the conflict? I can rebase my patch to your s390-next > branch, but the patch looks identical after that rebase. As far as I can > see, the patches only change different parts of the ipl.c file. Yes, but the result does not compile :)