John Burrell wrote:
>> ...Also, it is *not* possible to replace either /lib/ld-linux.so.2 or 
>> /lib64/ld-linux-x86-64.so.2 (...and yes, I use those paths intentionally,
>>  since those are the ABI standard) on a running system unless you replace
>> both it and /lib{,64}/libc.so.6 from the same process.
> 
> They are from the same process because I built

Hold on.

How you *built* them is utterly irrelevant.

How many processes you're using to *install* them into the running system is
relevant.

It is not possible to use the exec() syscall while the versions don't match,
because one version of ld-linux will be mapped by the kernel, which will then
map the other libc version in, and everything (in that process) will explode
when something tries to use mismatching code from both.

Using tar to extract directly to the target should work *as long as* tar
unlinks the target files before replacing them.

If you can manage to get a single invocation of "cp --remove-destination" to
copy all three files (both real files and the symlink), that might work.
Depends on what it does to the symlink.

>> (And you really want to "replace" them with an unlink() and copy, or copy
>> to a temp file and unlink()/link(), sequence.)
> 
> So the sequence I should follow is:
> 
> -rwxr-xr-x 1 root root 156051 Dec 11 08:40 ld-2.18.so
> lrwxrwxrwx 1 root root     10 Dec 11 08:40 ld-linux-x86-64.so.2 -> ld-2.18.so
> 
> 1) delete  ld-linux-x86-64.so.2
> 2) update ld-2.18.so

No.  You need to unlink *this* file, since it's mapped into several other
processes on the system.  But this file's name is inconsistent across systems;
the symlink name is consistent, which is why I use it.

Of course, you also need to restart every process that's using these files
after you replace them.

It would be *far, far, FAR* safer, and much less error prone, to simply not
run any process that's mapping in any of the files you're replacing when you
replace the files.  Yes, that means you can't do it from inside chroot, or
alternately you have to be running the binaries and libs from /tools.  But if
you do it this way you won't have any of the problems you're having.

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to