Solved Linuxlator chroot /compat/linux /bin/bash says stack smash?

I have been running CUDA with the linuxlator as can be seen in this post for some time now. It has been working really well so I decided to try an upgrade.

After pkg upgrade I get an error when trying to step into the linuxlator. The plan was to step into the linuxlator and upgrade the CUDA stuff.

Code:
chroot /compat/linux /bin/sh
*** stack smashing detected ***: terminated
Abort trap (core dumped)

I suspect this is a security abort to avoid memory tampering but since I haven't changed the Ubuntu something must have come with the FreeBSD upgrade? Is there a way to make bash trust the FreeBSD again?

The linux in the linuxlator is Ubuntu2204.

Code:
FreeBSD 15.1-RELEASE-p6 releng/15.1-n283643-95719d8a895b GENERIC amd64

mount
devfs on /dev (devfs)
fdescfs on /dev/fd (fdescfs)
procfs on /proc (procfs, local)
linprocfs on /compat/linux/proc (linprocfs, local)
linsysfs on /compat/linux/sys (linsysfs, local)
devfs on /compat/linux/dev (devfs)
fdescfs on /compat/linux/dev/fd (fdescfs)
tmpfs on /compat/linux/dev/shm (tmpfs, local)

sysctl compat.linux.osrelease
compat.linux.osrelease: 5.15.0

lldb chroot /compat/linux /bin/bash
(lldb) target create "chroot"
Current executable set to '/usr/sbin/chroot' (x86_64).
(lldb) settings set -- target.run-args  "/compat/linux" "/bin/bash"
(lldb) r
Process 3381 launched: '/usr/sbin/chroot' (x86_64)
Process 3381 stopped
* thread #1, name = 'bash', stop reason = exec
    frame #0: 0x0000000801181f30
->  0x801181f30: movq   %rsp, %rdi
    0x801181f33: callq  0x801182ca0
    0x801181f38: movq   %rax, %r12
    0x801181f3b: movl   0x19b97(%rip), %eax
(lldb) c
Process 3381 resuming
*** stack smashing detected ***: terminated
Process 3381 stopped
* thread #1, name = 'bash', stop reason = signal SIGABRT
    frame #0: 0x0000000801296a7c
->  0x801296a7c: movl   %eax, %r13d
    0x801296a7f: negl   %r13d
    0x801296a82: cmpl   $0xfffff000, %eax ; imm = 0xFFFFF000 
    0x801296a87: movl   $0x0, %eax
(lldb)

/grandpa
 
What did you upgrade? Base OS? Or your ports/packages?


Is kind of ambiguous nowadays, because this might include pkgbase updates.
I did pkg update && pkg upgrade.

I also did pkg upgrade -r FreeBSD-base to verify that kernel was upgraded and it told me it was already up to date.

Which FreeBSD version is this?
FreeBSD 15.1-RELEASE-p6 releng/15.1-n283643-95719d8a895b GENERIC amd64

/grandpa
 
Did you change anything before the update? Something that may have activated only after a reboot, which I presume you also did after the upgrade?
 
A freshly updated -current with rl9 linux base works fine here. Of course that is quite different from your stack.
 
Did you change anything before the update? Something that may have activated only after a reboot, which I presume you also did after the upgrade?
No changes before upgrade, the machine goes on and off daily.

After the upgrade I upgraded the nvidia drivers from 99 to 104 and the next step would have been to step into the linuxlator to upgrade the cuda stuff.

I guess I could try and rebuild the linuxlator retracing my post and see what happens.

I just got curious since it looks and feels like the stack protection comes from the linux side(?) and since I didn't touch that yet I thought I'd ask.

/grandpa
 
Looks like rebuilding the linux side works. I have a succesful chroot /compat/linux /bin/bash.

I just moved /compat/linux to anoher name, recreated /compat/linux directory and followed the necessary steps from my post. Not quite finished yet but since I made it past the chroot I assume it will work. Closing the thread.

/grandpa
 
Back
Top