Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755521Ab2EOGWx (ORCPT ); Tue, 15 May 2012 02:22:53 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46616 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752548Ab2EOGWw (ORCPT ); Tue, 15 May 2012 02:22:52 -0400 Message-ID: <4FB1F627.3080809@kernel.dk> Date: Tue, 15 May 2012 08:22:31 +0200 From: Jens Axboe MIME-Version: 1.0 To: Tejun Heo CC: Dave Jones , Linux Kernel , Szymon Gruszczynski , Fedora Kernel Team , Al Viro Subject: Re: [PATCH] block: fix buffer overflow when printing partition UUIDs References: <20120509195848.GA961@redhat.com> <20120514210353.GJ2366@google.com> In-Reply-To: <20120514210353.GJ2366@google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1683 Lines: 38 On 05/14/2012 11:03 PM, Tejun Heo wrote: > 6d1d8050b4bc8 "block, partition: add partition_meta_info to hd_struct" > added part_unpack_uuid() which assumes that the passed in buffer has > enough space for sprintfing "%pU" - 37 characters including '\0'. > > Unfortunately, b5af921ec0233 "init: add support for root devices > specified by partition UUID" supplied 33 bytes buffer to the function > leading to the following panic with stackprotector enabled. > > Kernel panic - not syncing: stack-protector: Kernel stack corrupted in: ffffffff81b14c7e > > [] panic+0xba/0x1c6 > [] ? printk_all_partitions+0x259/0x26xb > [] __stack_chk_fail+0x1b/0x20 > [] printk_all_paritions+0x259/0x26xb > [] mount_block_root+0x1bc/0x27f > [] mount_root+0x57/0x5b > [] prepare_namespace+0x13d/0x176 > [] ? release_tgcred.isra.4+0x330/0x30 > [] kernel_init+0x155/0x15a > [] ? schedule_tail+0x27/0xb0 > [] kernel_thread_helper+0x5/0x10 > [] ? start_kernel+0x3c5/0x3c5 > [] ? gs_change+0x13/0x13 > > Increase the buffer size, remove the dangerous part_unpack_uuid() and > use snprintf() directly from printk_all_partitions(). Ooops, thanks Tejun, applied for current branch. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/