[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#750378: freebsd-buildutils: Conflicting declarations of struct _node may result in invalid access



Hi,

On 03/06/14 00:55, Michael Tautschnig wrote:
> During a rebuild of all Debian packages in a clean sid chroot (using cowbuilder
> and pbuilder) the build failed with the following error. Please note that we
> use our research compiler tool-chain (using tools from the cbmc package), which
> permits extended reporting on type inconsistencies at link time.

This is really cool stuff!

Thanks a lot for reporting and for the followup investigation too.

> This is a bit of a guess, but I think it's the missing
> 
> #include <sys/stat.h>

Yes, I think it's related to that.  On many __GLIBC__ platforms, it will
declare _STATBUF_ST_NSEC to indicate nanosecond-resolution timestamps
are available.  So depending whether it was included before, the struct
member for mtime may be left out of here:

> typedef struct _node {
> 	[...]
> #ifdef __GLIBC__
> # ifdef _STATBUF_ST_NSEC
> #  define ST_MTIM st_mtim
> # endif
> #else
> # define ST_MTIM st_mtimespec
> #endif
> #ifdef ST_MTIM
> 	struct timespec	ST_MTIM;		/* last modification time */
> #endif

[note to self:  #ifdef within struct definition in header considered
harmful;  I'm curious how difficult it is to detect bugs like this at
compile time]


We could include <sys/stat.h> from mtree.h to fix this, but it's likely
unnecessary, or there could be still other problems.

These #ifdefs don't come from the upstream FreeBSD source, they were
added by a Debian patch written in 2004 to build this code on
linux-alpha!  ( http://bugs.debian.org/240023 ).  And it could be
unnecessary from glibc 2.3.4.

I couldn't see any problems running mtree on kfreebsd.  If there is a
problem it might be only symptomatic on Linux builds.  I'll try it some
other time.

It seems to build fine on at least kfreebsd with the ST_MTIM patches
removed so that is probably what will happen.

Thank again,
Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: