ports/emulators/linux_base on amd64

Ruslan Ermilov ru at FreeBSD.org
Wed Dec 15 02:26:25 PST 2004


On Tue, Dec 14, 2004 at 03:15:41PM -0800, Sean McNeil wrote:
> On Tue, 2004-12-14 at 14:13 -0800, Sean McNeil wrote:
> > On Tue, 2004-12-14 at 23:54 +0200, Ruslan Ermilov wrote:
> > > On Tue, Dec 14, 2004 at 10:34:06AM -0800, Sean McNeil wrote:
> > > [...]
> > > > rpm scripts should also be fixed.  It seems like a bug in the rpm port
> > > > that no one has addressed.
> > > > 
> > > rpm port is not guilty -- running the postinstall script
> > > manually on amd64 returns 1, but on i386 it returns 0:
> > > 
> > > Script started on Tue Dec 14 23:10:31 2004
> > > hammer#	/compat/linux/bin/sh
> > > sh-2.04# uname -srm
> > > Linux 2.4.2 amd64
> > > sh-2.04# /usr/sbin/glibc_post_upgrade 
> > > sh-2.04# echo $?
> > > 1
> > > Script done on Tue Dec 14 23:10:53 2004
> > 
> > Yes, I just got to this point.  Thanks for the confirmation.  I'm trying
> > to find sources to glibc_post_upgrade to take a look.
> 
> Here is what I have so far....
> 
> The source looks like this:
> 
> #ifdef ARCH_386
>   /* Work around rpm bug */
>   char *remove_file[] = {
>     "/lib/i686/libc-" VERSION ".so",
>     "/lib/i686/libm-" VERSION ".so",
>     "/lib/i686/libpthread-" PVERSION ".so",
>     "/lib/i686/libc.so.6",
>     "/lib/i686/libm.so.6",
>     "/lib/i686/libpthread.so.0",
>     NULL };
>   int i;
> 
>   for (i = 0; remove_file[i]; i++)
>     unlink (remove_file[i]);
> #endif
>   pid = vfork ();
>   if (pid == 0) {
>     execl ("/sbin/ldconfig", "/sbin/ldconfig", NULL);
>     _exit (1);
>   } else if (pid < 0) {
>     _exit (1);
>   }
>   if (waitpid (0, &status, 0) != pid || !WIFEXITED (status)) {
>     _exit (1);
>   }
>   if (WEXITSTATUS (status))
>     _exit (WEXITSTATUS (status));
> 
> ktrace shows:
> 
>   2018 ktrace   RET   ktrace 0
>   2018 ktrace   CALL
> execve(0x7fffffffee0f,0x7fffffffec60,0x7fffffffec70)
>   2018 ktrace   NAMI  "/compat/linux/usr/sbin/glibc_post_upgrade"
>   2018 glibc_post_upgrade RET   execve 0
>   2018 glibc_post_upgrade CALL  unlink(0x8048788)
>   2018 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libc-2.2.4.so"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libc-2.2.4.so"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  unlink(0x80487a0)
>   2018 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libm-2.2.4.so"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libm-2.2.4.so"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  unlink(0x80487b8)
>   2018 glibc_post_upgrade NAMI
> "/compat/linux/lib/i686/libpthread-0.9.so"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libpthread-0.9.so"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  unlink(0x80487d4)
>   2018 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libc.so.6"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libc.so.6"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  unlink(0x80487e8)
>   2018 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libm.so.6"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libm.so.6"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  unlink(0x80487fc)
>   2018 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libpthread.so.0"
>   2018 glibc_post_upgrade NAMI  "/lib/i686/libpthread.so.0"
>   2018 glibc_post_upgrade RET   unlink JUSTRETURN
>   2018 glibc_post_upgrade CALL  lstat
>   2018 glibc_post_upgrade RET   lstat 2019/0x7e3
>   2018 glibc_post_upgrade CALL  old.sendmsg(0,0xffffdb8c,0,0)
>   2018 glibc_post_upgrade RET   old.sendmsg 2019/0x7e3
>   2018 glibc_post_upgrade CALL  exit(0x1)
> 
> Looks like there is a mismatch in kernel entry points here.
> 
> lstat instead of vfork and old.sendmsg instead of (maybe) waitpid.
> 
> Does ktrace work with linux abi?
> 
On i386 it looks identical, except that sendmsg doesn't result in
exit(0x1):

 20167 ktrace   RET   ktrace 0
 20167 ktrace   CALL  execve(0xbfbfec77,0xbfbfeb60,0xbfbfeb68)
 20167 ktrace   NAMI  "/compat/linux/usr/sbin/glibc_post_upgrade"
 20167 glibc_post_upgrade RET   execve 0
 20167 glibc_post_upgrade CALL  unlink(0x8048788)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libc-2.2.4.so"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libc-2.2.4.so"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  unlink(0x80487a0)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libm-2.2.4.so"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libm-2.2.4.so"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  unlink(0x80487b8)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libpthread-0.9.so"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libpthread-0.9.so"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  unlink(0x80487d4)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libc.so.6"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libc.so.6"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  unlink(0x80487e8)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libm.so.6"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libm.so.6"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  unlink(0x80487fc)
 20167 glibc_post_upgrade NAMI  "/compat/linux/lib/i686/libpthread.so.0"
 20167 glibc_post_upgrade NAMI  "/lib/i686/libpthread.so.0"
 20167 glibc_post_upgrade RET   unlink JUSTRETURN
 20167 glibc_post_upgrade CALL  lstat
 20167 glibc_post_upgrade RET   lstat 20168/0x4ec8
 20167 glibc_post_upgrade CALL  old.sendmsg(0,0xbfbfea1c,0,0)
 20167 glibc_post_upgrade RET   old.sendmsg 20168/0x4ec8
 20167 glibc_post_upgrade CALL  accept(0x8048880,0)
 20167 glibc_post_upgrade NAMI  "/compat/linux/usr/lib/gconv/gconv-modules.cache"
 20167 glibc_post_upgrade NAMI  "/compat/linux"
 20167 glibc_post_upgrade NAMI  "/compat/linux/usr/lib/gconv/gconv-modules.cache"
 20167 glibc_post_upgrade RET   accept 0
 20167 glibc_post_upgrade CALL  lstat
 20167 glibc_post_upgrade RET   lstat 20171/0x4ecb
 20167 glibc_post_upgrade CALL  old.sendmsg(0,0xbfbfea1c,0,0)
 20167 glibc_post_upgrade RET   old.sendmsg 20171/0x4ecb
 20167 glibc_post_upgrade CALL  access(0x804883b,0x1)
 20167 glibc_post_upgrade NAMI  "/compat/linux/sbin/telinit"
 20167 glibc_post_upgrade NAMI  "/sbin/telinit"
 20167 glibc_post_upgrade RET   access JUSTRETURN
 20167 glibc_post_upgrade CALL  exit(0)

The reason for this is as follows:

hammer# grep -C3 TJR /sys/compat/linux/linux_socket.c 
        struct iovec *iov;
        int error;

        /* XXXTJR sendmsg is broken on amd64 */

        error = copyin(args, &linux_args, sizeof(linux_args));
        if (error)
--
        struct cmsghdr *cmsg;
        int error;

        /* XXXTJR recvmsg is broken on amd64 */

        if ((error = copyin(args, &linux_args, sizeof(linux_args))))
                return (error);


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20041215/86b6c61b/attachment.bin


More information about the freebsd-amd64 mailing list