#StackBounty: #linux-kernel #memory #embedded #executable #uclinux Linux kernel cannot execute any binary due to RAM Allocation issue

Bounty: 50

my platform:

SOC = STM32H743 (ARMv7E-M | Cortex-M7)
Board = Waveshare CoreH7XXI 
Linux Kernel = 5.8.10 (stable 2020-09-17)
initial defconfig file = stm32_defconfig
rootfs = built using busybox | busybox compiled using arm-linux-gnueabihf-gcc as FDPIC ELF

I’ve created my rootfs one time by following this guide and configured it by myself to compile it as FDPIC ELF (an elf that is position independent for mmu-less platforms such as arm_cortex-m family) and the other time I built it using buildroot (the toolchain and rootfs and kernel).

But it didn’t work. my kernel cannot execute any file even the init file I mean /linuxrc or /sbin/init (I know they are symlinks to the busybox’s binary). As I stated in the first paragraph, I tryed different executable formats (I mean FDPIC ELF and BFLT (flat binary)) but none of them worked and kernel throws the errno -12 error that means not enough memory.

this is my kernel log with log_level of 7:

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.7.19 (root@Mahyar1284) (gcc version 9.3.0 (Buildroot 2020.08), GNU ld (GNU Binutils) 2.32) #3 PREEMPT Sun Oct 11 08:20:09 +0330 2020
[    0.000000] CPU: ARMv7-M [411fc271] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Waveshare STM32H743i-Coreh7 board
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 1937
[    0.000000] Kernel command line: console=ttySTM0,115200n8 root=/dev/mmcblk0p2 rw rootwait loglevel=7 init=/linuxrc
[    0.000000] Dentry cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 5136K/7812K available (1517K kernel code, 142K rwdata, 556K rodata, 72K init, 114K bss, 2676K reserved, 0K cma-reserved)
[    0.866164] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    0.875365] devtmpfs: mounted
[    0.879076] Freeing unused kernel memory: 72K
[    0.883567] This architecture does not have kernel memory protection.
[    0.889882] Run /linuxrc as init process
[    0.902632] random: fast init done
[    0.911679] linuxrc: page allocation failure: order:8, mode:0xcc0(GFP_KERNEL), nodemask=(null)
[    0.922278] nommu: Allocation of length 675840 from process 1 (linuxrc) failed
[    0.929778] binfmt_flat: Unable to allocate RAM for process text/data, errno -12
[    0.937629] Kernel panic - not syncing: Requested init /linuxrc failed (error -12).
[    0.945187] ---[ end Kernel panic - not syncing: Requested init /linuxrc failed (error -12). ]---

Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.