Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 544570 - sys-apps/sandbox: 'value too large for defined data type' when cwd is in directory with inode not fitting into 32bit integer due to use of non-LFS interfaces internally
Summary: sys-apps/sandbox: 'value too large for defined data type' when cwd is in dire...
Status: RESOLVED DUPLICATE of bug 583282
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: 2015-03-26 16:07 UTC by Alexander Puchmayr
Modified: 2021-10-22 04:30 UTC (History)
2 users (show)

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


Attachments
Fix 64bit-inode problem in sandbox (file_544570.txt,925 bytes, patch)
2015-03-26 16:28 UTC, Alexander Puchmayr
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Puchmayr 2015-03-26 16:07:04 UTC
When invoking a sandbox on a 32bit system (I tested with armv7 and i686), and changing the current directory to a directory with inodes larger than 2^32 (i.e. it does not fit into a 32 bit unsigned integer), sandbox reports an error like 

 * ../../sandbox-2.6/libsandbox/libsandbox.c:check_syscall():879: failure (Value too large for defined data type):
 * ISE:
        abs_path: (null)
        res_path: /data/portage/portdir/eclass/ELT-patches
/usr/lib/libsandbox.so(+0xb29b)[0xb777129b]
/usr/lib/libsandbox.so(+0xb341)[0xb7771341]
/usr/lib/libsandbox.so(+0x3f6a)[0xb7769f6a]
/usr/lib/libsandbox.so(opendir+0x4c)[0xb776ce1c]
ls[0x804acd4]
/lib/libc.so.6(__libc_start_main+0xef)[0xb75bba4f]
ls[0x804c481]
/proc/6559/cmdline: ls --color=auto 

The problem becomes serious to me as I have my whole portage tree on an NFS share (with XFS as server filesystem) and it breaks ebuilds due to that.

Reproducible: Always

Steps to Reproduce:
1) On an 32bit system, e.g. x86/i686: Search for a directory that has inode number >=2^32. (No problem if <2^32 !!)
2) In a console, open a sandbox session. Change current directory to such a directory and call ls.

Actual Results:  
hermes ~ # sandbox
============================= Gentoo path sandbox ==============================
Detection of the support files.
Verification of the required files.
Setting up the required environment variables.
The protected environment has been started.
--------------------------------------------------------------------------------
Process being started in forked instance.

 * Loading sandboxed shell
 *  Log File:           /var/log/sandbox/sandbox-6532.log
 *  Debug Log File:     /var/log/sandbox/sandbox-debug-6532.log
 *  sandboxon:          turn sandbox on
 *  sandboxoff:         turn sandbox off
 *  addread <path>:     allow <path> to be read
 *  addwrite <path>:    allow <path> to be written
 *  adddeny <path>:     deny access to <path>
 *  addpredict <path>:  allow fake access to <path>

[s] hermes ~ # cd /data/portage/portdir/eclass/ELT-patches/
[s] hermes ELT-patches # ls
 * ../../sandbox-2.6/libsandbox/libsandbox.c:check_syscall():879: failure (Value too large for defined data type):
 * ISE:
        abs_path: (null)
        res_path: /data/portage/portdir/eclass/ELT-patches
/usr/lib/libsandbox.so(+0xb29b)[0xb777129b]
/usr/lib/libsandbox.so(+0xb341)[0xb7771341]
/usr/lib/libsandbox.so(+0x3f6a)[0xb7769f6a]
/usr/lib/libsandbox.so(opendir+0x4c)[0xb776ce1c]
ls[0x804acd4]
/lib/libc.so.6(__libc_start_main+0xef)[0xb75bba4f]
ls[0x804c481]
/proc/6559/cmdline: ls --color=auto 

Aborted
[s] hermes ELT-patches

Expected Results:  
output of ls in the directory

I tracked it down to a call to lstat in function egetcwd in file 
sandbox-2.6/libsandbox/libsandbox.c, line 301. It seems to be the 64bit-inode-problem...

A simple solution would be to ignore the fail condition if errno==EOVERFLOW in that case, since the returned struct stat is not used anyway.
Comment 1 Alexander Puchmayr 2015-03-26 16:28:42 UTC
Created attachment 399820 [details, diff]
Fix 64bit-inode problem in sandbox
Comment 2 Rafał Mużyło 2015-03-26 22:23:28 UTC
...any chance what's really needed there is a call to AC_SYS_LARGEFILE in configure.ac and passing its result to the build system ?
Comment 3 SpanKY gentoo-dev 2015-09-20 08:19:07 UTC
(In reply to Rafał Mużyło from comment #2)

no, we cannot allow transparent redirection of functional calls which AC_SYS_LARGEFILE enables.  libsandbox needs to be able to catch both the 32bit and 64bit calls.
Comment 4 Matthias Hanft 2020-11-07 09:45:25 UTC
You cannot even emerge sandbox on a 64 bit system when the file system has a size of 17 TB in total:

-------------------------------------------------------
checking whether we are cross compiling...  * /var/tmp/portage/sys-apps/sandbox-2.18/work/sandbox-2.18/libsandbox/libsandbox.c:check_syscall():974: failure (Value too large for defined data type):
 * ISE: fopen_wr(conftest.out)
        abs_path: (null)
        res_path: /var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20-abi_x86_32.x86/conftest.out
configure: error: in `/var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20-abi_x86_32.x86':
configure: error: cannot run C compiled programs.
-------------------------------------------------------

home01 ~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda4        17T   17T  279G  99% /

It can be overcome with

mount -t tmpfs none /var/tmp/portage

before emerge, but I guess this should be only a temporary solution..?!
Comment 5 Matthias Hanft 2021-05-22 11:25:56 UTC
Error still persists with sys-apps/sandbox-2.23.
Comment 6 SpanKY gentoo-dev 2021-10-22 04:30:21 UTC
ah, forgot this bug was kicking around.  sorry, going to dupe to a newer one where we've been collecting multiple reports of this already.

*** This bug has been marked as a duplicate of bug 583282 ***