[flashrom] [PATCH] Hack libpci not to exit(1) during init if PCI does not work

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Wed Sep 5 10:49:44 CEST 2012


On Thu, 07 Jul 2011 00:34:55 +0200
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> wrote:

> New version: Should work for the internal programmer as well.
> 
> TODO: Add sane error handling to pcidev_init() and its callers.
> 
> libpci unhelpfully calls exit(1) instead of reporting an error if init
> fails.
> Fortunately, that part of libpci has not changed since the year 2000, so
> we can use a really evil hack to avoid that.
> We supply an alternative error printing function (which does not
> exit(1)) and this function detects which error is happening and hacks
> internal libpci structures in a way that avoids a later segfault due to
> NULL pointer dereference.
> 
> We MUST absolutely make sure that pci_init() in libpci will not change
> or this hack will explode spectacularly. Once we decide that this hack
> is the way to go, notifying the libpci maintainer is essential.
> 

forgive me my naivety, but was upstream ever asked if they could
mitigate the problem (at least in the long term)? just exiting is of
course pretty much insane for any library... i would presume that they
understand that.

the git shows even less commits than in flashrom, so i think we would
have to do it on our own... but still better than the hack... in the
long term :)
-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list