As already reported in gentoo bugzilla while syslinux mailing list was not available: https://bugs.gentoo.org/show_bug.cgi?id=384917 All syslinux 4.xx versions (tested up to 4.04) seems to contain a bug, that causes a crash in early phase of syslinux boot from an usb stick. This is always possible to reproduce, but only on certain hw (atom based embedded board). Version 3.86 of syslinux always works with that hw. When syslinux 4.xx is used to setup bootable usb stick (which works on general desktop pc), that usb stick does not work with embedded atom based board. Screen is garbaged, flickering and the system hangs, instead of loading the image to be booted. Dissecting syslinux source code reveals, that the problem is within core/fs/cache.c function cache_init(), where seems to be an invalid pointer used to store an initial value - following patch fixes the problem by commenting out the offending line, that seems not to be needed anyway: --- syslinux-4.04/core/fs/cache.c-orig 2011-04-18 23:24:17.000000000 +0200 +++ syslinux-4.04/core/fs/cache.c 2011-09-29 10:54:46.000000000 +0200 @@ -40,7 +40,9 @@ void cache_init(struct device *dev, int cache = dev->cache_head + 1; /* First cache descriptor */ head->prev = &cache[dev->cache_entries-1]; - head->next->prev = dev->cache_head; + /* following line crashes on some hw - NULL dereference? */ + /* head->next->prev = dev->cache_head; */ + /* it should not be needed anyway, since following loop does it too */ head->block = -1; head->data = NULL; With that patch, syslinux works perfectly on the atom based embedded board as well as on general pc.
On Fri Oct 21 00:19:59 PDT 2011, Jan Safrata wrote:>As already reported in gentoo bugzilla while syslinux mailing list was not available: >https://bugs.gentoo.org/show_bug.cgi?id=384917 > >All syslinux 4.xx versions (tested up to 4.04) seems to contain a bug, that >causes a crash in early phase of syslinux boot from an usb stick. >This is always possible to reproduce, but only on certain hw (atom based >embedded board). >Version 3.86 of syslinux always works with that hw. > >When syslinux 4.xx is used to setup bootable usb stick (which works on general >desktop pc), that usb stick does not work with embedded atom based board. >Screen is garbaged, flickering and the system hangs, instead of loading the >image to be booted. > >Dissecting syslinux source code reveals, that the problem is within > core/fs/cache.c >function cache_init(), where seems to be an invalid pointer used to store an >initial value - following patch fixes the problem by commenting out the >offending line, that seems not to be needed anyway: > >--- syslinux-4.04/core/fs/cache.c-orig 2011-04-18 23:24:17.000000000 +0200 >+++ syslinux-4.04/core/fs/cache.c 2011-09-29 10:54:46.000000000 +0200 >@@ -40,7 +40,9 @@ void cache_init(struct device *dev, int > cache = dev->cache_head + 1; /* First cache descriptor */ > > head->prev = &cache[dev->cache_entries-1]; >- head->next->prev = dev->cache_head; >+ /* following line crashes on some hw - NULL dereference? */ >+ /* head->next->prev = dev->cache_head; */ >+ /* it should not be needed anyway, since following loop does it too */ > head->block = -1; > head->data = NULL; > >With that patch, syslinux works perfectly on the atom based embedded board as >well as on general pc.Please ACK or NACK the patch. Thanks & regards, Jan
H. Peter Anvin
2012-Feb-20 21:00 UTC
[syslinux] [PATCH] fix for boot crash of syslinux-4.xx
On 10/21/2011 12:19 AM, Jan Safrata wrote:> > > Dissecting syslinux source code reveals, that the problem is within > core/fs/cache.c > function cache_init(), where seems to be an invalid pointer used to store an > initial value - following patch fixes the problem by commenting out the > offending line, that seems not to be needed anyway: > > --- syslinux-4.04/core/fs/cache.c-orig 2011-04-18 23:24:17.000000000 +0200 > +++ syslinux-4.04/core/fs/cache.c 2011-09-29 10:54:46.000000000 +0200 > @@ -40,7 +40,9 @@ void cache_init(struct device *dev, int > cache = dev->cache_head + 1; /* First cache descriptor */ > > head->prev = &cache[dev->cache_entries-1]; > - head->next->prev = dev->cache_head; > + /* following line crashes on some hw - NULL dereference? */ > + /* head->next->prev = dev->cache_head; */ > + /* it should not be needed anyway, since following loop does it too */ > head->block = -1; > head->data = NULL; > > With that patch, syslinux works perfectly on the atom based embedded board as > well as on general pc. >Thanks for the reminder... I will look into it. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.