Bug#805965: boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

2015-11-24 Thread Hendrik Brueckner
On Tue, Nov 24, 2015 at 05:08:17PM +, Steve McIntyre wrote:
> On Tue, Nov 24, 2015 at 05:39:16PM +0100, Hendrik Brueckner wrote:
> >On Tue, Nov 24, 2015 at 01:00:13PM +, Steve McIntyre wrote:
> >> On Tue, Nov 24, 2015 at 12:38:16PM +0100, Hendrik Brueckner wrote:
> >> >
> >> >To correct this problem, please update the memory location to which
> >> >the initrd is loaded from 0x0080 (8M) to 0x0200 (32MB).
> >> >
> >> >The 0x0200 memory location is the preferred and commonly used
> >> >memory location.   As far as I could see, this affects all d390.ins
> >> >files, as well as, the boot-s390-common files which create the
> >> >root.off file.
> >> 
> >> ACK, thanks for your report. In fact, just 2 weeks back Philipp Kern
> >> (in CC) has added some fixes in this exact area in debian-cd
> >> git. He's moved the root.bin up to 0x0100 (16MB); I'd be happy to
> >> move it up to 0x0200 as you suggest. Phil - what do you think?
> >
> >Actually, the best solution would be to calculate this offset dynamically,
> >and write the modified root.off and d390.ins file.  For the initrd offset
> >calcuation, take the size of the vmlinuz kernel image + 4MB (0x0040).
> 
> OK, that's easy enough. Are there any alignment issues to worry about
> on top of that - do we have to pad that to the next 1MB, say?
> 
No alignment issues.  The initrd could be right after the kernel image.
Adding some space between prevents a potential move of the initrd.  The
kernel includes some checks to ensure the initrd does not collide, for
example, with the BSS section.  If it conflicts, the kernel moves the
initrd after these areas.  So providing some room between avoids some
memory copy operations.

Thanks and kind regards,
  Hendrik



Bug#805965: boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

2015-11-24 Thread Steve McIntyre
On Tue, Nov 24, 2015 at 05:39:16PM +0100, Hendrik Brueckner wrote:
>On Tue, Nov 24, 2015 at 01:00:13PM +, Steve McIntyre wrote:
>> On Tue, Nov 24, 2015 at 12:38:16PM +0100, Hendrik Brueckner wrote:
>> >
>> >To correct this problem, please update the memory location to which
>> >the initrd is loaded from 0x0080 (8M) to 0x0200 (32MB).
>> >
>> >The 0x0200 memory location is the preferred and commonly used
>> >memory location.   As far as I could see, this affects all d390.ins
>> >files, as well as, the boot-s390-common files which create the
>> >root.off file.
>> 
>> ACK, thanks for your report. In fact, just 2 weeks back Philipp Kern
>> (in CC) has added some fixes in this exact area in debian-cd
>> git. He's moved the root.bin up to 0x0100 (16MB); I'd be happy to
>> move it up to 0x0200 as you suggest. Phil - what do you think?
>
>Actually, the best solution would be to calculate this offset dynamically,
>and write the modified root.off and d390.ins file.  For the initrd offset
>calcuation, take the size of the vmlinuz kernel image + 4MB (0x0040).

OK, that's easy enough. Are there any alignment issues to worry about
on top of that - do we have to pad that to the next 1MB, say?

>The 4MB just adds some place for the kernel BSS section.  It is not
>strictly necessary, as the kernel moves the initrd out of its BSS
>section before it clearing it.
>
>This would be the better solution and it works even if the kernel grows
>over time.

Yup, it's more sustainable.

>> I'm also going to make sure the fixes are backported to our stable
>> build tree for the next point release.
>
>Thanks.  For backports, it should be sufficient to increase the offset
>for current and future, we might consider the dynamic approach above.

Definitely.

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
"Managing a volunteer open source project is a lot like herding
 kittens, except the kittens randomly appear and disappear because they
 have day jobs." -- Matt Mackall



Bug#805965: boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

2015-11-24 Thread Hendrik Brueckner
On Tue, Nov 24, 2015 at 01:00:13PM +, Steve McIntyre wrote:
> On Tue, Nov 24, 2015 at 12:38:16PM +0100, Hendrik Brueckner wrote:
> >Package: debian-cd
> >Version: 3.1.17
> >Severity: important
> >
> >Dear debian-cd Maintainers,
> >
> >I recently encountered a problem at the installation of Debian on s390:
> >
> >The d390.ins specifies where to load the kernel image and the initrd into
> >memory.  The current d390.ins uses:
> >
> >--
> >* Debian GNU/Linux for S/390 (boot from CD-ROM or FTP-Server)
> >linux_vm 0x
> >root.off 0x0001040c
> >root.siz 0x00010414
> >parmfile 0x00010480
> >root.bin 0x0080
> >--
> >
> >The size of the linux_vm is about 11M and the initrd is loaded at
> >the memory address 0x0080 (8M) which overrides the kernel image.
> >A result, the kernel and debian installer cannot be started on logical
> >partitions (LPAR) on z Systems.
> >
> >To correct this problem, please update the memory location to which
> >the initrd is loaded from 0x0080 (8M) to 0x0200 (32MB).
> >
> >The 0x0200 memory location is the preferred and commonly used
> >memory location.   As far as I could see, this affects all d390.ins
> >files, as well as, the boot-s390-common files which create the
> >root.off file.
> 
> ACK, thanks for your report. In fact, just 2 weeks back Philipp Kern
> (in CC) has added some fixes in this exact area in debian-cd
> git. He's moved the root.bin up to 0x0100 (16MB); I'd be happy to
> move it up to 0x0200 as you suggest. Phil - what do you think?

Actually, the best solution would be to calculate this offset dynamically,
and write the modified root.off and d390.ins file.  For the initrd offset
calcuation, take the size of the vmlinuz kernel image + 4MB (0x0040).

The 4MB just adds some place for the kernel BSS section.  It is not
strictly necessary, as the kernel moves the initrd out of its BSS
section before it clearing it.

This would be the better solution and it works even if the kernel grows
over time.

> 
> I'm also going to make sure the fixes are backported to our stable
> build tree for the next point release.

Thanks.  For backports, it should be sufficient to increase the offset
for current and future, we might consider the dynamic approach above.

Thanks and kind regards,
  Hendrik



Bug#805965: boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

2015-11-24 Thread Hendrik Brueckner
Package: debian-cd
Version: 3.1.17
Severity: important

Dear debian-cd Maintainers,

I recently encountered a problem at the installation of Debian on s390:

The d390.ins specifies where to load the kernel image and the initrd into
memory.  The current d390.ins uses:

--
* Debian GNU/Linux for S/390 (boot from CD-ROM or FTP-Server)
linux_vm 0x
root.off 0x0001040c
root.siz 0x00010414
parmfile 0x00010480
root.bin 0x0080
--

The size of the linux_vm is about 11M and the initrd is loaded at
the memory address 0x0080 (8M) which overrides the kernel image.
A result, the kernel and debian installer cannot be started on logical
partitions (LPAR) on z Systems.

To correct this problem, please update the memory location to which
the initrd is loaded from 0x0080 (8M) to 0x0200 (32MB).

The 0x0200 memory location is the preferred and commonly used
memory location.   As far as I could see, this affects all d390.ins
files, as well as, the boot-s390-common files which create the
root.off file.


Thanks and kind regards,
Hendrik

-- 
Hendrik Brueckner
brueck...@linux.vnet.ibm.com  | IBM Deutschland Research & Development GmbH
Linux on z Systems Development| Schoenaicher Str. 220, 71032 Boeblingen


IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



Bug#805965: boot-s390-common, d390.ins: initrd overwrites kernel due to a low offset

2015-11-24 Thread Steve McIntyre
On Tue, Nov 24, 2015 at 12:38:16PM +0100, Hendrik Brueckner wrote:
>Package: debian-cd
>Version: 3.1.17
>Severity: important
>
>Dear debian-cd Maintainers,
>
>I recently encountered a problem at the installation of Debian on s390:
>
>The d390.ins specifies where to load the kernel image and the initrd into
>memory.  The current d390.ins uses:
>
>--
>* Debian GNU/Linux for S/390 (boot from CD-ROM or FTP-Server)
>linux_vm 0x
>root.off 0x0001040c
>root.siz 0x00010414
>parmfile 0x00010480
>root.bin 0x0080
>--
>
>The size of the linux_vm is about 11M and the initrd is loaded at
>the memory address 0x0080 (8M) which overrides the kernel image.
>A result, the kernel and debian installer cannot be started on logical
>partitions (LPAR) on z Systems.
>
>To correct this problem, please update the memory location to which
>the initrd is loaded from 0x0080 (8M) to 0x0200 (32MB).
>
>The 0x0200 memory location is the preferred and commonly used
>memory location.   As far as I could see, this affects all d390.ins
>files, as well as, the boot-s390-common files which create the
>root.off file.

ACK, thanks for your report. In fact, just 2 weeks back Philipp Kern
(in CC) has added some fixes in this exact area in debian-cd
git. He's moved the root.bin up to 0x0100 (16MB); I'd be happy to
move it up to 0x0200 as you suggest. Phil - what do you think?

I'm also going to make sure the fixes are backported to our stable
build tree for the next point release.

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
Who needs computer imagery when you've got Brian Blessed?