Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
$ /bin/bash -c 'echo qqq'
qqq
$ /lib/ld-linux.so.2 /bin/bash -c 'echo qqq'
/bin/bash: xmalloc: ../bash/variables.c:2176: cannot allocate 3 bytes (8192 bytes allocated)

Why this happens (zsh4, python works well in this use case)? Can it be caused by "prelink"?

share|improve this question
    
Do you mean LD_PRELINK? –  djf Aug 15 '12 at 21:38
    
No, prelink (8) - prelink ELF shared libraries and binaries to speed up startup time –  Vi. Aug 15 '12 at 22:41
add comment

2 Answers

You may be trying to call 64-bit binary with 32-bit lib on amd64 architecture; in my case:

ls -l /lib/ld-linux.so.2
/lib/ld-linux.so.2 -> /lib32/ld-linux.so.2
share|improve this answer
    
/lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.13.so –  Vi. Aug 15 '12 at 22:41
    
@Vi.: and the output of file /bin/bash is... ? –  barti_ddu Aug 16 '12 at 15:30
    
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xb9a715b5137f1d8d532103e0f7f7a288039bf7f7, stripped –  Vi. Aug 16 '12 at 18:27
    
@Vi.: hmm, i was pretty sure, that you've mixed 32/64 bit components; what does strace -i /lib/ld-linux.so.2 /bin/bash -c 'echo qqq' produce? –  barti_ddu Aug 16 '12 at 18:56
1  
@Vi.: nothing criminal except the crash itself :/ however, this (bugs.launchpad.net/ubuntu/+source/bash/+bug/452175) report may be related –  barti_ddu Aug 16 '12 at 20:07
show 1 more comment
up vote 1 down vote accepted

As hinted by barti-ddu, it is likely a bug

The one of workarounds is to disable kernel allocation randomization:

echo 0 > /proc/sys/kernel/randomize_va_space
share|improve this answer
    
i wish you accepted your answer so that it stays on top ;) Concerning va space randomization it is better (if possible) to upgrade the kernel, since disabling it is a security risk. Anyway, glad you've resolved the loader issue, good luck. –  barti_ddu Aug 16 '12 at 21:32
    
"You can accept your own answer in 22 hours". You can re-post it as your answer, so I'll accept it. –  Vi. Aug 16 '12 at 22:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.