Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 872506 - sys-libs/binutils-libs-2.38-r2 fails to compile on stable chroot / bad permissions on /tmp
Summary: sys-libs/binutils-libs-2.38-r2 fails to compile on stable chroot / bad permis...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-23 08:37 UTC by Agostino Sarubbo
Modified: 2023-09-08 23:33 UTC (History)
2 users (show)

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


Attachments
build.log (file_872506.txt,9.19 KB, text/plain)
2022-09-23 08:37 UTC, Agostino Sarubbo
Details
emerge --info (file_872506.txt,5.70 KB, text/plain)
2022-09-23 08:38 UTC, Agostino Sarubbo
Details
strace (file_872506.txt,19.67 KB, text/plain)
2022-09-24 08:07 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-09-23 08:37:24 UTC
Created attachment 813778 [details]
build.log

I have a stable chroot where I test my packages befor push and I'm unable to update binutils and binutils-libs but I didn't understand why it it does not work.
Comment 1 Agostino Sarubbo gentoo-dev 2022-09-23 08:38:21 UTC
Created attachment 813781 [details]
emerge --info

This is the current status of the system:

chroot_qm ~ $ emerge -DuNpq world
[ebuild  r  U ] sys-libs/binutils-libs-2.38-r2 [2.37_p1-r2]
[ebuild  NS   ] sys-devel/binutils-2.38-r2 [2.37_p1-r2]
[ebuild     U ] sys-devel/gcc-11.3.0 [11.2.0]
[ebuild  rR   ] dev-db/mariadb-10.5.16 

The following packages are causing rebuilds:

  (sys-libs/binutils-libs-2.38-r2:0/2.38::gentoo, ebuild scheduled for merge) causes rebuilds for:
    (dev-db/mariadb-10.5.16:10.5/18::gentoo, ebuild scheduled for merge)
Comment 2 Ionen Wolkens gentoo-dev 2022-09-23 14:07:15 UTC
fwiw error 139 typically means a segmentation fault
Comment 3 Ionen Wolkens gentoo-dev 2022-09-23 14:13:57 UTC
(In reply to Ionen Wolkens from comment #2)
> fwiw error 139 typically means a segmentation fault
Could have a look at dmesg, it may show what is segfaulting and could try to rebuild that if it let you for starters (and select newer binutils, etc..)
Comment 4 Agostino Sarubbo gentoo-dev 2022-09-23 14:27:32 UTC
(In reply to Ionen Wolkens from comment #3)
> (In reply to Ionen Wolkens from comment #2)
> > fwiw error 139 typically means a segmentation fault
> Could have a look at dmesg, it may show what is segfaulting and could try to
> rebuild that if it let you for starters (and select newer binutils, etc..)

Indeed that's what I did :)

dmesg reports:
[ven set 23 16:18:52 2022] make[13012]: segfault at 7ffd2979eec0 ip 00007f1c72457077 sp 00007ffd2979eec0 error 6 in libc.so.6[7f1c72414000+16b000]


I rebuilt make but I see the same failure. However if I'm going to /var/tmp/portage/sys-libs/binutils-libs-2.38-r2/work/binutils-2.38-abi_x86_64.amd64 and manually type "make" or "make --output-sync=line -j4 V=1" I don't get a segfault...
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2022-09-23 15:15:13 UTC
(In reply to Agostino Sarubbo from comment #4)
> (In reply to Ionen Wolkens from comment #3)
> > (In reply to Ionen Wolkens from comment #2)
> > > fwiw error 139 typically means a segmentation fault
> > Could have a look at dmesg, it may show what is segfaulting and could try to
> > rebuild that if it let you for starters (and select newer binutils, etc..)
> 
> Indeed that's what I did :)
> 
> dmesg reports:
> [ven set 23 16:18:52 2022] make[13012]: segfault at 7ffd2979eec0 ip
> 00007f1c72457077 sp 00007ffd2979eec0 error 6 in
> libc.so.6[7f1c72414000+16b000]
> 
> 
> I rebuilt make but I see the same failure. However if I'm going to
> /var/tmp/portage/sys-libs/binutils-libs-2.38-r2/work/binutils-2.38-
> abi_x86_64.amd64 and manually type "make" or "make --output-sync=line -j4
> V=1" I don't get a segfault...

Best idea I have, rebuild make with debug info, get a core dump, print backtrace from the core dump...
Comment 6 Agostino Sarubbo gentoo-dev 2022-09-24 06:27:19 UTC
I didn't get a core dump (I have support in the kernel), however I digged a bit and I found that the issue is in the emake helper, so I modified emake to run:

gdb -ex "run" -ex "bt" --args make ${MAKEOPTS} ${@} ${EXTRA_EMAKE}


and I get:

>>> Compiling source in /var/tmp/portage/sys-libs/binutils-libs-2.38-r2/work/binutils-2.38 ...
 * abi_x86_64.amd64: running multilib-minimal_abi_src_compile
GNU gdb (Gentoo 11.2 vanilla) 11.2
Copyright (C) 2022 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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from make...
Starting program: /usr/bin/make --output-sync=line -j4 V=1
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
 * ACCESS DENIED:  open_wr:       /proc/54/task/54/mem
Failed to read a valid object file image from memory.
[Detaching after vfork from child process 58]
[Detaching after vfork from child process 59]
make: *** [Makefile:1000: all] Error 139
[Inferior 1 (process 54) exited with code 02]
No stack.
(gdb) quit
>>> Source compiled.
 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/sys-libs/binutils-libs-2.38-r2/temp/sandbox.log"
 * 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /proc/54/task/54/mem
A: /proc/54/task/54/mem
R: /proc/54/task/54/mem
C: gdb -ex run -ex bt --args make --output-sync=line -j4 V=1 



So /proc is mounted and here is:
proc on /media/dati/chroot_qm/proc type proc (rw,nosuid,nodev,noexec,relatime)

and /proc/54 does not exists here. I still don't understand what happens...
Comment 7 Agostino Sarubbo gentoo-dev 2022-09-24 08:07:19 UTC
Created attachment 813934 [details]
strace

I was able to reproduce this issue manually with the portage user.

The thing that makes the problem happen is '-j4'

So:
"make --output-sync=line -j4" does not work
"make -j4 --output-sync=line" does not work
"make --output-sync=line" works for me

Because of a chance I saw that /tmp was not 777, and after chmod 777 /tmp it worked.
So I'm wondering if we can move this bug as "portage should check for /tmp as 777, otherwise things do not work"
I asked sam's feedback on irc about.
Comment 8 Mike Gilbert gentoo-dev 2022-09-24 15:36:22 UTC
(In reply to Agostino Sarubbo from comment #7)

baselayout creates /tmp with mode 1777. systemd mounts /tmp as a tmpfs with mode 1777. Please update whatever documentation/scripts you use to create a chroot environment.

I don't think it makes sense to have portage check for it; it affects many more programs than just portage.
Comment 9 Hanno Böck gentoo-dev 2023-04-26 17:34:57 UTC
FWIW I have been seeing the same issue (also in a gentoo chroot). It is unclear to me how this happened. I've been using this chroot for a while and am pretty sure I would've noticed if this was happening for longer. I wonder if there's something in the chroot scenario where the permission get changed unintentionally, as it seems this happened to both me and ago.
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2023-09-08 23:33:19 UTC
Well, no duplicates for a long time so this seems to have been fixed. 

Strongly suggesting something more comfortable than a bare chroot though...