From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1abXoe-0001wF-Qh for mharc-grub-devel@gnu.org; Thu, 03 Mar 2016 13:17:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abXob-0001vN-Oq for grub-devel@gnu.org; Thu, 03 Mar 2016 13:17:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abXoY-0005W5-IV for grub-devel@gnu.org; Thu, 03 Mar 2016 13:17:33 -0500 Received: from mail-lb0-x22b.google.com ([2a00:1450:4010:c04::22b]:34131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abXoY-0005TT-9C for grub-devel@gnu.org; Thu, 03 Mar 2016 13:17:30 -0500 Received: by mail-lb0-x22b.google.com with SMTP id cf7so17352055lbb.1 for ; Thu, 03 Mar 2016 10:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=/bS+058XF5IC55yPQDEBocsP/EKBQQw2dEDRoOBDOAI=; b=MUR8zXN1ft4QN62QeqwjUqxJqr7xc/4GTGvkvgf/mIPJxrMzGHY195SrwKLIpmEyl6 wBnvRKSmBD6PkN92TIqzS+FtxBjbZNP6vxxU7yktqVKIu9y94uUT08cskf/0CuEXQqlL RiYD/Pa2LRvlR2Zpn9e64wnbRGYd06znU3IbHHh7ChfkmQ8BaT69tzEmbS3imp3O7slz mt5UWaRXA8uq5muPNKWIPpXARrrTiqDJPmBxx8iESk60onq7c0vCXqMsHQPHmkLm+DKP m7KnFHpR5l5FsO+J7BVaWiArhUCuvVHTsmLnb+P7LGeEaJ7+5YVOrqbP4FS5uQrH8VhT Q7qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/bS+058XF5IC55yPQDEBocsP/EKBQQw2dEDRoOBDOAI=; b=UXKkT/292id+PM+U1MQPARNKtwUa4+uqLevD5zzpnZJHmEJJFNXqVa1kluGbgXZqSR IGDTB8XjkWieeEC0gNO5CfDCUt7zg6RdywHtBWTeTaEYOvvIfydlmt48spZpTw8j/XMy EYwRK+Z6+kj8muLKP4dmSY5EmmzkrKvAogQ8w+EbztmHLiyMKQ+65cr+1aM9XnRVyg/E BSx+v/PLIHdVnHX6eyWaGnwZzKYis+e/eqcaA16JmDUHDAoZGLNEMnP6KcIfiUiT7yXn KF4PeTyphJXJDUejfIo7Cq8SLzOndpQORznRxUcurVkkkV8HJQ/rb+IN19N8zkLBUYMK UaDg== X-Gm-Message-State: AD7BkJLAzWytZ+pN2g2h4zBbT+ZFul4iZ8FM2v9nAJc0SU/LnmousgccQlRHKT4hfXMkaw== X-Received: by 10.25.151.149 with SMTP id z143mr1356245lfd.72.1457029049446; Thu, 03 Mar 2016 10:17:29 -0800 (PST) Received: from [192.168.1.41] (ppp109-252-76-159.pppoe.spdop.ru. [109.252.76.159]) by smtp.gmail.com with ESMTPSA id t17sm3278610lfd.17.2016.03.03.10.17.27 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 10:17:28 -0800 (PST) Subject: Re: [PATCH] fix attempt to seek outside of the file error when parsing xen ELF notes To: grub-devel@gnu.org References: <20160303073328.GA32595@leap-t5810.suse> From: Andrei Borzenkov Message-ID: <56D87FB7.8070108@gmail.com> Date: Thu, 3 Mar 2016 21:17:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160303073328.GA32595@leap-t5810.suse> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::22b X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2016 18:17:35 -0000 03.03.2016 10:33, Michael Chang пишет: > The kernel bzImage payload length appears to be incorrectly minus by 4 when > trying to grub_file_offset_open for the uncompressed vmlinux image. If gzip > used as compressor it will lead to the file->size read from offset of crc32 > instead of the uncompressed image size. > > [1] > http://www.onicos.com/staff/iz/formats/gzip.html > --- > grub-core/loader/i386/xen_file.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c > index 5836218..37f9ad8 100644 > --- a/grub-core/loader/i386/xen_file.c > +++ b/grub-core/loader/i386/xen_file.c > @@ -55,11 +55,11 @@ grub_xen_file (grub_file_t file) > grub_dprintf ("xen", "found bzimage payload 0x%llx-0x%llx\n", > (unsigned long long) (lh.setup_sects + 1) * 512 > + lh.payload_offset, > - (unsigned long long) lh.payload_length - 4); > + (unsigned long long) lh.payload_length); > > off_file = grub_file_offset_open (file, (lh.setup_sects + 1) * 512 > + lh.payload_offset, > - lh.payload_length - 4); > + lh.payload_length); > if (!off_file) > goto fail; > > Looks strange indeed. I wonder what was original intention, code looked this way from the very beginning. May be it is required with some other format?