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

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



Package: freebsd-buildutils
Version: 10.0-4
Usertags: goto-cc

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.

[...]
gcc -O2 -g -Wall -D_GNU_SOURCE -DMACHINE_ARCH='"amd64"' -DMACHINE_MULTIARCH='"x86_64-linux-gnu"' -I/srv/jenkins-slave/workspace/sid-goto-cc-freebsd-buildutils/freebsd-buildutils-10.0/build-tree/src/sys -D_GNU_SOURCE=1 -isystem /usr/include/freebsd  -std=gnu99 -fstack-protector   -o fmtree compare.o crc.o create.o excludes.o misc.o mtree.o spec.o verify.o specspec.o -lbsd

error: conflicting function declarations "mtree_readspec"
old definition in module spec file spec.c line 58
struct _node * (struct _IO_FILE *fi)
new definition in module specspec file extern.h line 44
struct _node * (struct _IO_FILE *)

reason for conflict in types listed below (struct/struct):
composite type component counts differ (22/21)
struct _node {
  struct _node * parent;
  struct _node * child;
  struct _node * prev;
  struct _node * next;
  signed long int st_size;
  struct timespec st_mtim;
  unsigned long int cksum;
  char * md5digest;
  char * sha1digest;
  char * sha256digest;
  char * rmd160digest;
  char * slink;
  unsigned int st_uid;
  unsigned int st_gid;
  unsigned int st_mode;
  unsigned int <padding>;
  unsigned long int st_flags;
  unsigned long int st_nlink;
  unsigned int flags;
  unsigned char type;
  char [1l] name;
  unsigned short int <padding>;
}
struct _node {
  struct _node * parent;
  struct _node * child;
  struct _node * prev;
  struct _node * next;
  signed long int st_size;
  unsigned long int cksum;
  char * md5digest;
  char * sha1digest;
  char * sha256digest;
  char * rmd160digest;
  char * slink;
  unsigned int st_uid;
  unsigned int st_gid;
  unsigned int st_mode;
  unsigned int <padding>;
  unsigned long int st_flags;
  unsigned long int st_nlink;
  unsigned int flags;
  unsigned char type;
  char [1l] name;
  unsigned short int <padding>;
}
*** Error code 64

Stop.
bmake[1]: stopped in /srv/jenkins-slave/workspace/sid-goto-cc-freebsd-buildutils/freebsd-buildutils-10.0/build-tree/src/usr.sbin/mtree
debian/rules:107: recipe for target 'build-stamp' failed
make: *** [build-stamp] Error 1

Observe the missing st_mtim field in the second declaration. Consequently the
offsets of all further members will differ, which will result in wrong (or
invalid) accesses when passing around objects between the two compilation units
(spec and specspec). Indeed this appears to be happening here:

http://sources.debian.net/src/freebsd-buildutils/10.0-4/src/usr.sbin/mtree/specspec.c?hl=249,250#L249

This is a bit of a guess, but I think it's the missing

#include <sys/stat.h>

in specspec.c that is causing this difference.

Best,
Michael

Attachment: pgpj8QDRCT8PO.pgp
Description: PGP signature


Reply to: