DragonFly BSD
DragonFly bugs List (threaded) for 2003-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Linux emulation

From: Jeroen Ruigrok/asmodai <asmodai@xxxxxx>
Date: Tue, 19 Aug 2003 19:54:10 +0200

Just to make sure this is a separate thread.

I've been digging into the code a bit.

This is what strace -fFvx gives me:

unlink("/etc/ld.so.cache~")             = -1 E??? (errno -2)
write(134523867, 0x3, 134972320)        = 400
write(134523953, 0x3, 3217029728)       = 0
write(134524020, 0x3, 134972728)        = 816
write(134524085, 0x3, 134971144)        = 1168
close(3)                                = 0
chmod("/etc/ld.so.cache~", 0644)        = 0
stat?("/etc/ld.so.cache~", {st_dev=makedev(101, 1668546607), st_ino=778333231, st_mode=S_IFBLK|S_ISUID|S_ISGID|S_ISVTX|0563, st_nlink=25390, st_uid=1701340001, st_gid=134931200, st_blksize=1, st_blocks=3217029960, st_rdev=makedev(0, 0), st_atime=0, st_mtime=1974/04/10-23:37:52, st_ctime=1970/01/01-01:00:01, st_flags=UF_APPEND|UF_OPAQUE|UF_NOUNLINK|SF_ARCHIVED|SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|0xbfa8fb60, st_gen=3217030020}) = 0
--- SIGSEGV (Segmentation fault) ---
--- SIGSEGV (Segmentation fault) ---

This comes from glibc's elf/cache.c:

  /* First remove an old copy if it exists.  */
  if (unlink (temp_name) && errno != ENOENT)
    error (EXIT_FAILURE, errno, _("Can't remove old temporary cache file %s"),
  /* Create file.  */
  fd = open (temp_name, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW,
  if (fd < 0)
    error (EXIT_FAILURE, errno, _("Can't create temporary cache file %s"),
  /* Write contents.  */
  if (opt_format != 2)
      if (write (fd, file_entries, file_entries_size)
          != (ssize_t)file_entries_size)
        error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
  if (opt_format != 0)
      /* Align cache.  */
      if (opt_format != 2)
          char zero[pad];
          if (write (fd, zero, pad) != (ssize_t)pad)
            error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
      if (write (fd, file_entries_new, file_entries_new_size)
          != (ssize_t)file_entries_new_size)
        error (EXIT_FAILURE, errno, _("Writing of cache data failed"));

  if (write (fd, strings, total_strlen) != (ssize_t)total_strlen)
    error (EXIT_FAILURE, errno, _("Writing of cache data failed."));

  close (fd);

  /* Make sure user can always read cache file */
  if (chmod (temp_name, S_IROTH|S_IRGRP|S_IRUSR|S_IWUSR))
    error (EXIT_FAILURE, errno,
           _("Changing access rights of %s to %#o failed"), temp_name,

  /* Move temporary to its final location.  */
  if (rename (temp_name, cache_name))
    error (EXIT_FAILURE, errno, _("Renaming of %s to %s failed"), temp_name,

This is from the function save_cache(), which is called from ldconfig.c
as such:

  if (opt_build_cache)
    save_cache (cache_file);

  return 0;

Weird thing is, when I run it as a normal user:

unlink("/etc/ld.so.cache~")             = -1 E??? (errno -2)
open("?Ã?Ä?Û?", O_RDONLY|O_EXCL|O_NOCTTY|O_ASYNC|O_DIRECT|O_SHLOCK|O_EXLOCK|0x80a0000) = -1 E??? (errno -13)
write(134558434, 0x2, 3217019632/compat/linux/sbin/ldconfig: )       = 29
write(134558434, 0x2, 3217018560Can't create temporary cache file /etc/ld.so.cache~)       = 51
write(134558434, 0x2, 3217018528: Permission denied)       = 19
write(134558434, 0x2, 134953575
)        = 1
--- SIGSEGV (Segmentation fault) ---
--- SIGSEGV (Segmentation fault) ---

So it cannot create the file.  It should then bail out out of save_cache().
And it still gives the segmentation fault.

Whereas the code has been reached to the end though.  So it isn't any of
the code's use of systemcalls messing it up.

I need to dig in deeper for this.

Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai
PGP fingerprint: 2D92 980E 45FE 2C28 9DB7  9D88 97E6 839B 2EAC 625B
http://www.tendra.org/   | http://www.in-nomine.org/~asmodai/diary/
Forging the Future from the Timeless Stone...

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