Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930014 - sys-devel/gcc-14.0.1_pre20240407[modula2]: sandbox access violation
Summary: sys-devel/gcc-14.0.1_pre20240407[modula2]: sandbox access violation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PATCH
: 931007 (view as bug list)
Depends on:
Blocks: gcc-14
  Show dependency tree
 
Reported: 2024-04-14 14:08 UTC by hugegameartgd
Modified: 2024-06-27 08:46 UTC (History)
6 users (show)

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


Attachments
sandbox.log (sandbox.log,1.37 KB, text/x-log)
2024-04-14 14:08 UTC, hugegameartgd
Details
gcc-build-logs (gcc-build-logs.tar.xz,379.26 KB, application/x-xz)
2024-04-14 14:10 UTC, hugegameartgd
Details
m2.patch (m2.patch,550 bytes, patch)
2024-05-10 17:51 UTC, hugegameartgd
Details | Diff
build.log (m2.patch applied) (m2-patch-build.log.gz,675.67 KB, application/gzip)
2024-05-10 17:53 UTC, hugegameartgd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hugegameartgd 2024-04-14 14:08:46 UTC
Created attachment 890823 [details]
sandbox.log

On Gentoo Linux amd64 musl llvm, upgrading the GCC installation fails with a sandbox access violation:

```
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build/x86_64-pc-linux-musl/libgrust'
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build/x86_64-pc-linux-musl/libgrust'
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build/x86_64-pc-linux-musl/libgrust'
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build'
 * Deleting '/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir'
>>> Completed installing sys-devel/gcc-14.0.1_pre20240407 into /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image

 * Final size of build directory: 3278588 KiB (  3.1 GiB)
 * Final size of installed tree:   849028 KiB (829.1 MiB)

 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/temp/sandbox.log"
--------------------------------------------------------------------------------
 * 
 * Please include /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/gcc-build-logs.tar.xz in your bug report.
 * 

 * Messages for package sys-devel/gcc-14.0.1_pre20240407:

 * 
 * Please include /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/gcc-build-logs.tar.xz in your bug report.
 * 
```

gcc-compiler make.conf:
```
CFLAGS="-march=native -O2 -pipe -D_LARGEFILE64_SOURCE"
CXXFLAGS="${CFLAGS}"
FFLAGS="${CFLAGS}"
FCFLAGS="${CFLAGS}"
FC="gfortran"
CC="gcc"
CXX="g++"
LDFLAGS="${CFLAGS} ${LDLIBS} -Wl,-O2 -Wl,--as-needed -fuse-ld=bfd"
LD="ld.bfd"
AS="as"
AR="ar"
NM="nm"
RANLIB="ranlib"
OBJCOPY="objcopy"
CPP="cpp"
```
Comment 1 hugegameartgd 2024-04-14 14:10:00 UTC
Created attachment 890824 [details]
gcc-build-logs
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-14 18:06:10 UTC
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: mkstemp
S: deny
P: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
A: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
R: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
C: install-info --dir-file=/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info 

F: chmod
S: deny
P: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
A: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
R: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
C: install-info --dir-file=/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info 

F: remove
S: deny
P: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
A: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
R: /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
C: install-info --dir-file=/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info 
 [31;01m*[0m --------------------------------------------------------------------------------

----

```
  if [ -f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build/gcc/doc/m2.info ]; then \
    rm -f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info*; \
    for f in /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/build/gcc/doc/m2.info*; do \
      realfile=`echo $f | sed -e 's|.*/\([^/]*\)$|\1|'`; \
              rm -f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/`basename $realfile`; \
      /usr/lib/portage/python3.12/ebuild-helpers/xattr/install -c -m 644 $f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/`basename $realfile`; \
    done; \
    chmod a-x /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info*; \
  else true; fi; \
else true; fi
if [ -f gm2 ] && [ -f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info ]; then \
  if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
    install-info --dir-file=/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/share/gcc-data/x86_64-pc-linux-musl/14/info/m2.info; \
  else true; fi; \
else true; fi
 [31;01m*[0m [31;01mACCESS DENIED[0m:  mkstemp:            /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
 [31;01m*[0m [31;01mACCESS DENIED[0m:  chmod:              /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
 [31;01m*[0m [31;01mACCESS DENIED[0m:  remove:             /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
install-info: Permission denied for /usr/share/gcc-data/x86_64-pc-linux-musl/14/info/dir-XXXXXX
make[2]: [/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/work/gcc-14-20240407/gcc/m2/Make-lang.in:416: m2.install-info] Error 1 (ignored)
rm -f /var/tmp/portage/sys-devel/gcc-14.0.1_pre20240407/image/usr/x86_64-pc-linux-musl/gcc-bin/14/gcc
```
Comment 3 Yotam Frechter 2024-04-16 12:20:11 UTC
Looks like failure in the package stage, post install. If such, it should still be possible to merge the package (only without creating a binary package).
code:
# right after receiving the error message, make sure you're root and then
cd /var/db/repos/gentoo/sys-devel/gcc
ebuild gcc-<number_of_your_gcc_package>.ebuild qmerge
# Should work. You can also do a
ebuild gcc-<number_of_your_gcc_package>.ebuild clean
# Later, to clean up the waste files. Note you will still be unable to package 
# it. The bug is still there.. But at least you can use the new gcc.
Comment 4 Arsen Arsenović gentoo-dev 2024-04-16 13:23:06 UTC
i have a theory:

          if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
            install-info --dir-file=$(infodir)/dir $(DESTDIR)$(infodir)/m2.info; \
          else true; fi; \

^ missing $(DESTDIR) on the --dir-file (m2.install-info)

could you try reproducing but changing that line (gcc/m2/Make-lang.in, in m2.install-info) to say '--dir-file=$(DESTDIR)$(infodir)/dir'?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-01 06:46:18 UTC
*** Bug 931007 has been marked as a duplicate of this bug. ***
Comment 6 hugegameartgd 2024-05-10 17:51:43 UTC
Created attachment 892701 [details, diff]
m2.patch

(In reply to Yotam Frechter from comment #3)
> If such, it should still be possible to merge the package

Yes, the installation can be resumed as a workaround

(In reply to Arsen Arsenović from comment #4)
> i have a theory:
> 
>           if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
>             install-info --dir-file=$(infodir)/dir
> $(DESTDIR)$(infodir)/m2.info; \
>           else true; fi; \
> 
> ^ missing $(DESTDIR) on the --dir-file (m2.install-info)
> 
> could you try reproducing but changing that line (gcc/m2/Make-lang.in, in
> m2.install-info) to say '--dir-file=$(DESTDIR)$(infodir)/dir'?

Thanks, rebuilding gcc with the patch resolves the sandbox error
Comment 7 hugegameartgd 2024-05-10 17:53:50 UTC
Created attachment 892702 [details]
build.log (m2.patch applied)
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-27 06:58:59 UTC
Apparently I didn't backport it. Let me do that now.
Comment 10 Larry the Git Cow gentoo-dev 2024-06-27 08:44:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=eddf9c85473ad7a63f11c24c664429ebbc8a850f

commit eddf9c85473ad7a63f11c24c664429ebbc8a850f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-06-27 08:43:50 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-06-27 08:43:50 +0000

    14.1.0: add 77_all_m2_docs_sandbox.patch
    
    Bug: https://bugs.gentoo.org/930014
    Signed-off-by: Sam James <sam@gentoo.org>

 14.1.0/gentoo/77_all_m2_docs_sandbox.patch | 37 ++++++++++++++++++++++++++++++
 14.1.0/gentoo/README.history               |  4 ++++
 2 files changed, 41 insertions(+)
Comment 11 Larry the Git Cow gentoo-dev 2024-06-27 08:46:55 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58a8301f8c8d595a6a921dc93f0916461ba8d838

commit 58a8301f8c8d595a6a921dc93f0916461ba8d838
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-06-27 08:46:25 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-06-27 08:46:25 +0000

    sys-devel/gcc: fix modula2 docs sandbox issue
    
    Closes: https://bugs.gentoo.org/930014
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 1 +
 sys-devel/gcc/gcc-14.1.1_p20240622.ebuild | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)