Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 300166 - segmentation fault for cp and mv related to libattr
Summary: segmentation fault for cp and mv related to libattr
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Robert Piasek (RETIRED)
URL:
Whiteboard:
Keywords:
: 339765 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-08 14:46 UTC by Robert Piasek (RETIRED)
Modified: 2010-10-07 01:59 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Piasek (RETIRED) gentoo-dev 2010-01-08 14:46:45 UTC
Hi,

I've got this problem on two similar systems. When I mount /var/tmp as tmpfs with kernel 2.6.31/32 (didn't try with older ones), I got segfault on _all_ "cp -a" and _all_ mv operations. I also have XATTR enabled for all filesystems I use:

zcat /proc/config.gz | grep XATT
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_REISERFS_FS_XATTR=y
CONFIG_JFFS2_FS_XATTR=y
CONFIG_UBIFS_FS_XATTR=y
CONFIG_CIFS_XATTR=y


The most recent failed package was crossdev.

>>> Starting src_install                                                                                 
make -j5 install DESTDIR=/var/tmp/paludis/sys-devel-crossdev-20100108/image/                             
install -m 755 -d /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                          
install -m 755 crossdev /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                    
make -C wrappers install                                                                                 
make[1]: Entering directory `/var/tmp/paludis/sys-devel-crossdev-20100108/work/crossdev-20100108/wrappers'
install -m 755 -d /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/ /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/include/site
install -m 755 cross-emerge  cross-fix-root  cross-pkg-config  emerge-wrapper /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                         
cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/                                                                                  
make[1]: Leaving directory `/var/tmp/paludis/sys-devel-crossdev-20100108/work/crossdev-20100108/wrappers'                                                           
make[1]: *** [install] Segmentation fault                                                                                                                           
make: *** [install] Error 2                                                                                                                                         
/usr/libexec/paludis/utils/emake: emake returned error 2                       


dmesg says:
[1384337.651592] cp[4074]: segfault at 7ffe9e5fbe68 ip 00002b4c48f353f6 sp 00007ffe9e5fbe70 error 6 in libattr.so.1.1.0[2b4c48f33000+4000]         

going further, I recompiled attr with -O0 -ggdb and got this backtrace:

gdb --args cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
GNU gdb (Gentoo 7.0.1 p1) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /bin/cp...(no debugging symbols found)...done.
(gdb) r
Starting program: /bin/cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77ca9bf in attr_copy_fd (src_path=0x61e310 "etc/portage/env/sys-apps/busybox", src_fd=5, dst_path=0x61e340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox", dst_fd=6,
    check=0x7ffff77cbc40 <attr_copy_check_permissions>, ctx=0x0) at attr_copy_fd.c:95
95      attr_copy_fd.c: No such file or directory.
        in attr_copy_fd.c

line 95 in attr_copy_fd.c is:
size = flistxattr (src_fd, names, size);


Also package manager I'm using is calling flistxattr to establish proper attrs and warns about problems:


  ... When installing file '/var/tmp/paludis/sys-apps-attr-2.4.43/image/lib64/libattr.so.1.1.0' to '/lib64' with protection 'libattr.so.1.1.0':                                                                                              
  ... flistxattr returned 4294967274, which clearly isn't right. Are you using some crazy ricer filesystem or kernel?                                                                                                                        

Installing same package (crossdev in this case) without /var/tmp as tmpfs works perfectly fine:

>>> Starting src_install                                                                                 
make -j5 install DESTDIR=/var/tmp/paludis/sys-devel-crossdev-20100108/image/                             
install -m 755 -d /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                          
install -m 755 crossdev /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                    
make -C wrappers install                                                                                 
make[1]: Entering directory `/var/tmp/paludis/sys-devel-crossdev-20100108/work/crossdev-20100108/wrappers'
install -m 755 -d /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/ /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/include/site
install -m 755 cross-emerge  cross-fix-root  cross-pkg-config  emerge-wrapper /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/                         
cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/                                                                                  
cp -a site /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/include/                                                                         
sed -i -e s@__PREFIX__@/usr@g /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/bin/emerge-wrapper                                                           
sed -i -e s@__TOPDIR__@/usr/share/crossdev/include/site@g /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/include/site/config.site          
mv /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/include/site/config.site /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/ 
ln -sf /var/paludis/repositories/gentoo/profiles/embedded /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/make.profile                  
make[1]: Leaving directory `/var/tmp/paludis/sys-devel-crossdev-20100108/work/crossdev-20100108/wrappers'                                                           
>>> Done src_install                                                      

Generally I'm assuming the problem lies somewhere in kernel's tmpfs implementation, but it's a blind guess. Maybe some wiser heads could have a look on that and share some light.

(just for the reference all my packages are from ~arch, so gcc-4.4.2, glibc-2.11)


Reproducible: Always
Comment 1 Robert Piasek (RETIRED) gentoo-dev 2010-01-08 15:22:35 UTC
Complete backtrace:

ob wrappers # gdb --args cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
GNU gdb (Gentoo 7.0.1 p1) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /bin/cp...done.
(gdb) r
Starting program: /bin/cp -a etc /var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77ca9bf in attr_copy_fd (src_path=0x625310 "etc/portage/env/sys-apps/busybox", src_fd=5, dst_path=0x625340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox", dst_fd=6,
    check=0x7ffff77cbc40 <attr_copy_check_permissions>, ctx=0x0) at attr_copy_fd.c:95
95      attr_copy_fd.c: No such file or directory.
        in attr_copy_fd.c
(gdb) bt
#0  0x00007ffff77ca9bf in attr_copy_fd (src_path=0x625310 "etc/portage/env/sys-apps/busybox", src_fd=5, dst_path=0x625340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox",
    dst_fd=6, check=0x7ffff77cbc40 <attr_copy_check_permissions>, ctx=0x0) at attr_copy_fd.c:95
#1  0x000000000040554c in copy_attr_by_fd (src_path=0x625310 "etc/portage/env/sys-apps/busybox", src_fd=5, dst_path=0x625340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox",
    dst_fd=6, x=0x7fffffffc400) at copy.c:229
#2  0x0000000000406780 in copy_reg (src_name=0x625310 "etc/portage/env/sys-apps/busybox", dst_name=0x625340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox", x=0x7fffffffc400,
    dst_mode=420, omitted_permissions=0, new_dst=0x7fffffffc05c, src_sb=0x7fffffffc230) at copy.c:842
#3  0x0000000000408f13 in copy_internal (src_name=0x625310 "etc/portage/env/sys-apps/busybox", dst_name=0x625340 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps/busybox", new_dst=false,
    device=18, ancestors=0x7fffffffc4a0, x=0x7fffffffc400, command_line_arg=false, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffc3ff, rename_succeeded=0x0) at copy.c:2010
#4  0x000000000040578f in copy_dir (src_name_in=0x625040 "etc/portage/env/sys-apps", dst_name_in=0x6249d0 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps", new_dst=false,
    src_sb=0x7fffffffc6d0, ancestors=0x7fffffffc4a0, x=0x7fffffffc8a0, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffc89f) at copy.c:311
#5  0x0000000000408c47 in copy_internal (src_name=0x625040 "etc/portage/env/sys-apps", dst_name=0x6249d0 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env/sys-apps", new_dst=false, device=18,
    ancestors=0x7fffffffc940, x=0x7fffffffc8a0, command_line_arg=false, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffc89f, rename_succeeded=0x0) at copy.c:1945
#6  0x000000000040578f in copy_dir (src_name_in=0x624d30 "etc/portage/env", dst_name_in=0x624d50 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env", new_dst=false, src_sb=0x7fffffffcb70,
    ancestors=0x7fffffffc940, x=0x7fffffffcd40, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffcd3f) at copy.c:311
#7  0x0000000000408c47 in copy_internal (src_name=0x624d30 "etc/portage/env", dst_name=0x624d50 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage/env", new_dst=false, device=18,
    ancestors=0x7fffffffcde0, x=0x7fffffffcd40, command_line_arg=false, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffcd3f, rename_succeeded=0x0) at copy.c:1945
#8  0x000000000040578f in copy_dir (src_name_in=0x6249b0 "etc/portage", dst_name_in=0x624a60 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage", new_dst=false, src_sb=0x7fffffffd010,
    ancestors=0x7fffffffcde0, x=0x7fffffffd1e0, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffd1df) at copy.c:311
#9  0x0000000000408c47 in copy_internal (src_name=0x6249b0 "etc/portage", dst_name=0x624a60 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc/portage", new_dst=false, device=18, ancestors=0x7fffffffd280,
    x=0x7fffffffd1e0, command_line_arg=false, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffd1df, rename_succeeded=0x0) at copy.c:1945
#10 0x000000000040578f in copy_dir (src_name_in=0x7fffffffde1f "etc", dst_name_in=0x6248d0 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc", new_dst=false, src_sb=0x7fffffffd4b0, ancestors=0x7fffffffd280,
    x=0x7fffffffd900, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffd6f7) at copy.c:311
#11 0x0000000000408c47 in copy_internal (src_name=0x7fffffffde1f "etc", dst_name=0x6248d0 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc", new_dst=false, device=0, ancestors=0x0, x=0x7fffffffd900,
    command_line_arg=true, first_dir_created_per_command_line_arg=0x7fffffffd67f, copy_into_self=0x7fffffffd6f7, rename_succeeded=0x0) at copy.c:1945
#12 0x0000000000409ab5 in copy (src_name=0x7fffffffde1f "etc", dst_name=0x6248d0 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/etc", nonexistent_dst=false, options=0x7fffffffd900,
    copy_into_self=0x7fffffffd6f7, rename_succeeded=0x0) at copy.c:2296
#13 0x00000000004043dd in do_copy (n_files=1, file=0x7fffffffda88, target_directory=0x7fffffffde23 "/var/tmp/paludis/sys-devel-crossdev-20100108/image///usr/share/crossdev/", no_target_directory=false, x=0x7fffffffd900) at cp.c:692
#14 0x0000000000404f7e in main (argc=4, argv=0x7fffffffda78) at cp.c:1154
(gdb)
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-01-29 04:51:31 UTC
Please please assign your own bugs.
Comment 3 Robert Piasek (RETIRED) gentoo-dev 2010-02-01 14:20:06 UTC
actually I wanted someone wiser to have a look on that - like Vapier or someone from toolchain herd.
Comment 4 SpanKY gentoo-dev 2010-02-03 19:09:15 UTC
looks like Bug 217290.  likely not a bug in the toolchain, but coreutils or acl/attr.
Comment 5 Robert Piasek (RETIRED) gentoo-dev 2010-07-21 11:24:49 UTC
after investigation (thanks to ciaranm's and peper's help) it seems that problem is related to CONFIG_SECURITY_SMACK=y

Disabling this kernel option solves everything. I will file a bug report upstream.
Comment 6 SpanKY gentoo-dev 2010-10-07 01:59:36 UTC
*** Bug 339765 has been marked as a duplicate of this bug. ***