Incompatibility of Rasperry BalenaOS with mongo:8.0.9-noble

Hi,
When running mongod inside a container based on mongo:8.0.9-noble on Raspberry 5 [balenaOS 5.3.22], I’m getting following error which I’m not getting on the generic-AARCH64 OS:

12 src/third_party/tcmalloc/dist/tcmalloc/system-alloc.cc:755] MmapAligned() failed - unable to allocate with tag (hint=0x4c8680000000, size=1073741824, alignment=1073741824) - is something limiting address placement?
12 src/third_party/tcmalloc/dist/tcmalloc/arena.cc:48] CHECK in Alloc: FATAL ERROR: Out of memory trying to allocate internal tcmalloc data (bytes=131072, object-size=640); is something preventing mmap from succeeding (sandbox, VSS limitations)?

According to Envoy 1.17-1.23 unable to start on Raspberry · Issue #23339 · envoyproxy/envoy · GitHub, this could be avoided by compiling the kernel with CONFIG_ARM64_VA_BITS_48=y.

The kernel is compiled with:

CONFIG_ARM64_VA_BITS_48=n
CONFIG_ARM64_VA_BITS=39

This means the kernel is limited to a 39-bit virtual address space, which allows addressing up to 512 GB of virtual memory. The address 0x4c8680000000 is well beyond the 39-bit limit:

  • 39-bit max address: 0x7FFFFFFFFF (512 GB)
  • Your hint address: 0x4c8680000000 (≈ 5 TB)

So the kernel cannot map memory at that high address because it’s outside the allowed virtual address range.

Has this changed in newer kernels otherwise this may be something to look into for a future kernel update?

How could I retrieve the kernel configuration of a certain OS without having to install it?

I’m probably going to revert to an older mongo version that does run on the current kernel

Hi, balenaOS uses the defconfig that comes with the linux-raspberrypi kernel, and then applies some extra configuration that comes from the Yocto project kernel team.

I suspect the choice of ARM64_VA_BITS_48 comes down to security, as the 52bits comes with the following note:

          NOTE: Enabling 52-bit virtual addressing in conjunction with              
          ARMv8.3 Pointer Authentication will result in the PAC being               
          reduced from 7 bits to 3 bits, which may have a significant               
          impact on its susceptibility to brute-force attacks.                      
                                                                                    
          If unsure, select 48-bit virtual addressing instead. 

I checked whether this has changed in more recent kernels, and it has but not for the better. With the enablement of 16KB page sizes this setting has actually changed to ARM64_VA_BITS_47.

How could I retrieve the kernel configuration of a certain OS without having to install it?

This is something that we have wanted to expose for a while but haven’t get round to it. Currently what you can do is pull the kernel headers and use the .config included on it. To pull the kernel headers you can take a look at how the kernel-module-build example project does it.

Hope that helps.