[Linux-ha-dev] Hb-2.08/stable: cib crashes under solaris 10/i386

David Lee t.d.lee at durham.ac.uk
Thu May 3 05:11:56 MDT 2007


On Thu, 3 May 2007, Andrew Beekhof wrote:

> On 5/2/07, Otte, Joerg <joerg.otte at nsn.com> wrote:
> > I am trying to get heartbeat 2.08/stable running under Solaris 10 /
> > I386.
> > OS: SunOS bcm20-a 5.10 Generic_125101-03 i86pc i386 i86pc
> >
> > Whereas V1 configuration seem to work properly (I didn't go into details
> > yet),
> > I currently have the following problem with a V2 configuration:
> >
> > Case 1) "The cib process crashes with core dump on the second node."
>
> I wonder... could this be as simple as trying to print a NULL pointer
> as a string?

Highly likely.  Most descriptions of "%s" that I've seen ("printf" man
pages, the "Posix Programmer's Guide", etc.) say that the argument is
expected to be a pointer to a null-terminated string.  This suggests that
callers should avoid passing a NULL pointer.  (To reinforce that, one OS's
manpage adds "A null value for args will yield undefined results".)

I'm sure that in years gone by, I have myself tripped over this in
heartbeat (core dump on Solaris from NULL pointer in "printf"-like
contexts) and applied patches.  More such bugs probably lurk.

Some OSes might try to be friendly, by surviving such null-pointer
incidents.  That may be thought to be nice for the runtime user on those
particular OSes.  But from the software engineering perspective it
whitewashes over a coding flaw (that the caller should not pass a NULL
pointer for printf-like %s arguments) that will then bite runtime users on
other OSes.  (That's particularly bad news in a project which aims to
create reliable systems!)

Do code-analysis tools like Coverity pick up this sort of problem?


-- 

:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:  UNIX Team Leader                         Durham University     :
:                                           South Road            :
:  http://www.dur.ac.uk/t.d.lee/            Durham DH1 3LE        :
:  Phone: +44 191 334 2752                  U.K.                  :


More information about the Linux-HA-Dev mailing list