Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 598752 - sys-apps/sandbox-2.18: emerge dev-lisp/gcl fails
Summary: sys-apps/sandbox-2.18: emerge dev-lisp/gcl fails
Status: RESOLVED OBSOLETE
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-02 10:00 UTC by Andrey Grozin
Modified: 2021-10-22 05:17 UTC (History)
5 users (show)

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


Attachments
strace output (gcl_fail.strace,14.86 KB, text/plain)
2016-11-02 10:00 UTC, Andrey Grozin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Grozin gentoo-dev 2016-11-02 10:00:26 UTC
Created attachment 452154 [details]
strace output

With sandbox-2.10-r1 gcl emerged fine. With 2.10-r2

cp init_pcl_gcl.lsp foo
echo " (in-package \"USER\")(system:save-system \"saved_pcl_gcl\")" >>foo
ar x libpcl_gcl.a $(ar t libpcl_gcl.a |grep ^gcl_)
/var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/raw_pcl_gcl /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ -libdir /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/ < foo

Unrecoverable error: Segmentation violation..
/bin/sh: line 1: 22515 Aborted                 /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/raw_pcl_gcl /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ -libdir /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/ < foo
make[1]: *** [makefile:130: saved_pcl_gcl] Error 134
rm init_pcl_gcl.lsp raw_pcl_gcl
make[1]: Leaving directory '/var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport'
make: *** [makefile:88: unixport/saved_pcl_gcl] Error 2

When I go to /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ and run raw_gcl with *exactly the same parameters* from the command line, it succeeds and produces saved_gcl.

I've modified unixport/makefile to run raw_gcl under gdb and produce backtrace. This is the result:

(gdb) Starting program: /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/raw_gcl
/var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ -libdir /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/ < foo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000367ee0 in calloc ()
(gdb) #0  0x0000000000367ee0 in calloc ()
#1  0x00007ffff737f687 in ?? () from /lib64/libdl.so.2
#2  0x00007ffff737f158 in dlsym () from /lib64/libdl.so.2
#3  0x00007ffff7bc2fc8 in ?? () from /usr/lib64/libsandbox.so
#4  0x00007ffff7bc1e4e in ?? () from /usr/lib64/libsandbox.so
#5  0x00007ffff7bc802b in ?? () from /usr/lib64/libsandbox.so
#6  0x00007ffff7bc08a7 in ?? () from /usr/lib64/libsandbox.so
#7  0x00007ffff7bc0c98 in ?? () from /usr/lib64/libsandbox.so
#8  0x00007ffff7bc5b9c in open () from /usr/lib64/libsandbox.so
#9  0x0000000000312a89 in get_phys_pages_no_malloc ()
#10 0x0000000000312c08 in update_real_maxpage ()
#11 0x0000000000365aea in gcl_init_alloc ()
#12 0x0000000000366ba2 in malloc ()
#13 0x0000000000367ed0 in calloc ()
#14 0x00007ffff737f687 in ?? () from /lib64/libdl.so.2
#15 0x00007ffff737f158 in dlsym () from /lib64/libdl.so.2
#16 0x00007ffff7bc2fc8 in ?? () from /usr/lib64/libsandbox.so
#17 0x00007ffff7bc1e4e in ?? () from /usr/lib64/libsandbox.so
#18 0x00007ffff7bc802b in ?? () from /usr/lib64/libsandbox.so
#19 0x00007ffff7bc08a7 in ?? () from /usr/lib64/libsandbox.so
#20 0x00007ffff7bbfa26 in ?? () from /usr/lib64/libsandbox.so
#21 0x00007ffff7de82da in ?? () from /lib64/ld-linux-x86-64.so.2
#22 0x00007ffff7de83eb in ?? () from /lib64/ld-linux-x86-64.so.2
---Type <return> to continue, or q <return> to quit---Quit

I've also modified unixport/makefile to run raw_gcl under strace, the result is attached. This is the letter I received from Camm Maguire, the author of gcl:

Greetings!  In the failing environment, there is apparently some wrapper
to open() which is interfering with a read of /proc/meminfo:

17104 brk(0x800d12000)                  = 0x800d12000
17104 brk(0x800d16000)                  = 0x800d16000
17104 brk(0x800d18000)                  = 0x800d18000
17104 brk(0xd1b000)                     = 0xd1b000
17104 open("/proc/meminfo", O_RDONLY)   = 3
17104 read(3, "MemTotal:        8074492 kB\nMemF"..., 4096) = 1011
17104 close(3)                          = 0
17104 brk(0xcd9e3000)                   = 0xcd9e3000
17104 stat("/proc/17104/exe", {st_mode=S_IFREG|0755, st_size=4446024, ...}) = 0

vs

16803 brk(0x800d0a000)                  = 0x800d0a000
16803 brk(0x800d12000)                  = 0x800d12000
16803 brk(0x800d16000)                  = 0x800d16000
16803 brk(0x800d18000)                  = 0x800d18000
16803 brk(0xd1b000)                     = 0xd1b000
16803 stat("/proc/meminfo", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
16803 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1f} ---
16803 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
16803 write(1, "\nUnrecoverable error: ", 22) = 22
16803 write(1, "S", 1)                  = 1
16803 write(1, "egmentation violation.", 22) = 22

This method of determining the runtime available memory has been
replaced in 2.6.13pre with (hopefully) more robust alternatives.  But
hopefully this should point out what is going on.

FEATURES="-sandbox -usersandbox" emerge gcl

solves the problem.
Comment 1 SpanKY gentoo-dev 2016-11-10 21:49:07 UTC
pretty sure i already fixed this with sandbox-2.11 via https://crbug.com/586444
Comment 2 Andrey Grozin gentoo-dev 2016-11-12 09:49:15 UTC
(In reply to SpanKY from comment #1)
> pretty sure i already fixed this with sandbox-2.11 via
> https://crbug.com/586444
It's masked:

# Patrick Lauer (30 Mar 2015)
# Segfaults when creating directories #578582
=sys-apps/sandbox-2.11*
Comment 3 SpanKY gentoo-dev 2016-11-15 04:26:10 UTC
(In reply to Andrey Grozin from comment #2)

which Patrick never told anyone in his standard style.  i'll fix that.
Comment 4 Andrey Grozin gentoo-dev 2016-11-15 11:23:56 UTC
After upgrade to sandbox-2.11-r2 nothing changed. The output of gdb is

(gdb) Starting program: /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/raw_gcl /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ -libdir /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/ < foo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000367ee0 in calloc ()
(gdb) #0  0x0000000000367ee0 in calloc ()
#1  0x00007ffff737f687 in ?? () from /lib64/libdl.so.2
#2  0x00007ffff737f158 in dlsym () from /lib64/libdl.so.2
#3  0x00007ffff7bc2f08 in ?? () from /usr/lib64/libsandbox.so
#4  0x00007ffff7bc201e in ?? () from /usr/lib64/libsandbox.so
#5  0x00007ffff7bc898b in ?? () from /usr/lib64/libsandbox.so
#6  0x00007ffff7bc08e7 in ?? () from /usr/lib64/libsandbox.so
#7  0x00007ffff7bc0cd8 in ?? () from /usr/lib64/libsandbox.so
#8  0x00007ffff7bc650c in open () from /usr/lib64/libsandbox.so
#9  0x0000000000312a89 in get_phys_pages_no_malloc ()
#10 0x0000000000312c08 in update_real_maxpage ()
#11 0x0000000000365aea in gcl_init_alloc ()
#12 0x0000000000366ba2 in malloc ()
#13 0x0000000000367ed0 in calloc ()
#14 0x00007ffff737f687 in ?? () from /lib64/libdl.so.2
#15 0x00007ffff737f158 in dlsym () from /lib64/libdl.so.2
#16 0x00007ffff7bc2f08 in ?? () from /usr/lib64/libsandbox.so
#17 0x00007ffff7bc201e in ?? () from /usr/lib64/libsandbox.so
#18 0x00007ffff7bc898b in ?? () from /usr/lib64/libsandbox.so
#19 0x00007ffff7bc08e7 in ?? () from /usr/lib64/libsandbox.so
#20 0x00007ffff7bbfa66 in ?? () from /usr/lib64/libsandbox.so
#21 0x00007ffff7de82ba in ?? () from /lib64/ld-linux-x86-64.so.2
#22 0x00007ffff7de83cb in ?? () from /lib64/ld-linux-x86-64.so.2
---Type <return> to continue, or q <return> to quit---Quit
(gdb) quit

I can get the strace output if needed.
Comment 5 Alessandro Barbieri 2019-09-07 01:45:43 UTC
This is still an issue with dev-lisp/gcl-2.6.12 and sys-apps/sandbox-2.18

ar: creating libpre_gcl.a
cp ../o/gcllib.a libgclp.a
ranlib libgclp.a
cp init_pre_gcl.lsp.in init_pre_gcl.lsp.tmp
cat init_pre_gcl.lsp.tmp | sed \
        -e "s#@LI-VERS@#(`cat ../majvers`.`cat ../minvers`) `date`#1" \
        -e "s#@LI-EXTVERS@#`cat ../minvers | cut -f2 -d.`#1" \
        -e "s#@LI-MINVERS@#`cat ../minvers | cut -f1 -d.`#1" \
        -e "s#@LI-MAJVERS@#`cat ../majvers`#1" \
        -e "s#@LI-CC@#\"gcc -c -Os -pipe -march=native -mtune=native -Wdate-time -Wno-error=implicit-function-declaration -Wformat -Wformat-security -Wl,-O1 -Wl,--as-needed -Wl,-O2 -Wl,-fuse-ld=bfd -Wl,--hash-style=gnu -Wl,--gc-sections
-fgnu89-inline  -D_REENTRANT -DREENTRANT  -Wall -fsigned-char -Wno-unused-but-set-variable -pipe \"#1" \
        -e "s#@LI-LD@#\"gcc -Wl,-O1 -Wl,--as-needed -Wl,-O2 -Wl,--as-needed -Wl,-fuse-ld=bfd -Wl,--hash-style=gnu -Wl,--gc-sections -Wl,-T ../unixport/gcl.script -o \"#1" \
        -e "s#@LI-LD-LIBS@#\"  -lpre_gcl -lm -ldl  -lgmp -lreadline -lc -lgclp\"#1" \
        -e "s#@LI-OPT-THREE@#\"-O3 \"#1" \
        -e "s#@LI-OPT-TWO@#\"-O\"#1" \
        -e "s#@LI-INIT-LSP@#\"init_pre_gcl.lsp\"#1" >init_pre_gcl.lsp
touch raw_pre_gcl_map
gcc -Wl,-O1 -Wl,--as-needed -Wl,-O2 -Wl,--as-needed -Wl,-fuse-ld=bfd -Wl,--hash-style=gnu -Wl,--gc-sections -Wl,-T ../unixport/gcl.script -o raw_pre_gcl  -L.  -Wl,-Map raw_pre_gcl_map  -lpre_gcl -lm -ldl  -lgmp -lreadline -lc -lgclp
chcon -t gcl_exec_t raw_pre_gcl || true
chcon: failed to get security context of 'raw_pre_gcl': Operation not supported
PATH=/usr/bin:$PATH gcc msys.c -o msys # Unix binary if running wine
cp init_pre_gcl.lsp foo
echo " (in-package \"USER\")(system:save-system \"saved_pre_gcl\")" >>foo
ar x libpre_gcl.a $(ar t libpre_gcl.a |grep ^gcl_)
/var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/raw_pre_gcl /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport/ -libdir /var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/ < foo

Unrecoverable error: Segmentation violation..
make[1]: *** [makefile:130: saved_pre_gcl] Aborted (core dumped)
rm raw_pre_gcl
make[1]: Leaving directory '/var/tmp/portage/dev-lisp/gcl-2.6.12/work/gcl/unixport'
make: *** [makefile:78: unixport/saved_pre_gcl] Error 2
rm h/mcompdefs.h
 * ERROR: dev-lisp/gcl-2.6.12::gentoo failed (compile phase):
 *   emake failed
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-07 06:13:22 UTC
I'm afraid that unless someone can figure it out and/or supply a patch, we should simply lastrite gcl.  It's not the only lisp compiler out there, and FWICS no packages depend on it exclusively.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-10-22 05:17:12 UTC
AFAIK this isn't an issue anymore.