Project

General

Profile

Bug #1487

some binaries fail to work in a chroot environment.

Added by Andrew Stormont about 8 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2011-09-09
Due date:
% Done:

0%

Estimated time:
Difficulty:
Hard
Tags:
needs-triage

Description

Elf files with the interpreter set to /usr/lib/libc.so.1 work for the most part these but in a chroot environment fail with a very unhelpful error:

  1. /usr/bin/bash
    : no (or bad) /usr/lib/ld.so.1

Either the error should be updated to reflect the real problem or _rtboot.s should be updated to fall back to using ld.so.1 in cases like these.


Related issues

Related to illumos gate - Bug #2186: ELF files with libc.so.1 as interpreter report errors badlyNew2012-02-26

Actions

History

#1

Updated by Andrew Stormont about 8 years ago

Andrew Stormont wrote:

Elf files with the interpreter set to /usr/lib/libc.so.1 work for the most part but in a chroot environment fail with a very unhelpful error:

  1. /usr/bin/bash
    : no (or bad) /usr/lib/ld.so.1

Either the error should be updated to reflect the real problem or _rtboot.s should be updated to fall back to using ld.so.1 in cases like these.

#2

Updated by Igor Kozhukhov almost 8 years ago

is it OI environment or another?
I don't have this problems on OI environment.

#3

Updated by Rich Lowe almost 8 years ago

Either the error should be updated to reflect the real problem or _rtboot.s should be updated to fall back to using ld.so.1 in cases like these.

Definitely should not use an interpreter other than that specified.

#4

Updated by Rich Lowe over 7 years ago

  • Category set to lib - userland libraries
  • Assignee set to Rich Lowe

I'm a glutton for punishment, or something. I'll look into this.

#5

Updated by Rich Lowe over 7 years ago

  • Status changed from New to Rejected
  • Difficulty changed from Medium to Hard

The problem is that your chroot does not contain /dev/zero.

When an executable has /lib/libc.so.1 as its interpretter, we have to load ld.so ourselves prior to the existence of the runtime linker.

We do this by having __rtboot setup a very very basic boot environment, and call __rtld which maps the linker into memory, and returns the address of the linkers _rt_boot, to which we then jump to allow normal ELF bootstrap and runtime linking to ensue.

The key point in this backstory is that we have to map the actual runtime linker, ld.so (thus, the filename about which rtboot complains is correct), when mapping it we possibly need to zero out a chunk of the mapping, this occurs when the size of a segment in memory is greater than that in the file. This is true, for eg, because of BSS (which ld.so has). this means that we need to map /dev/zero, which you don't. We can't, so we fail because we can't use your interpretter.

I'm going to file a separate bug regarding some quirks about error reporting, which has more problems than this but is not necessarily simple to solve.

As it stands, this as reported isn't a bug, the chroot is incomplete.

#6

Updated by Andrew Stormont over 7 years ago

Looks like you were right. /devices/psuedo was not mounted so /dev/zero was just a dangling symlink.

Also available in: Atom PDF