SB2 fails to mmap 8GB in Aarch64

REPRODUCIBILITY: Always
OS VERSION: 4.5.0.18
HARDWARE: Platform SDK
UI LANGUAGE: NA
REGRESSION: Not known

DESCRIPTION:

As a part of QT WebEngine compilation, one executable (mksnapshot) is started to generate code. This executable fails and it can be isolated to larger mmap allocation. The problem can be reproduced with the following code:

#include <iostream>
#include <sys/mman.h>

int main()
{
  std::cout << "MMap test\n";
  
  void *hint = 0;
  size_t size = 8*1024UL*1024UL*1024UL; //8589934592UL;
  int prot = 0;
  int flags = 16418;
  int kMmapFd = -1;
  int kMmapFdOffset = 0;
  void* result = mmap(hint, size, prot, flags, kMmapFd, kMmapFdOffset);

  std::cout << "Result: " << result << " - size: " << size << "\n";
  std::cout << ((result == MAP_FAILED) ? "Failed" : "Success") << "\n";
  return 0;
}

On Platform SDK, using AARCH64 target, I get:

MMap test
Result: 0xffffffffffffffff - size: 8589934592
Failed

On PC:

MMap test
Result: 0x7f502f94d000 - size: 8589934592
Success

When running on the original application (mksnapshot) on device, all works as expected. This is even with the device (XZ2) having 4GB RAM. Haven’t tested the test code on device, though.

PRECONDITIONS:

None

STEPS TO REPRODUCE:

  1. Save C++ test example into test.cpp
  2. Enter Platform SDK SB2 environment: sb2 -t devel-aarch64 bash
  3. Compile and run the code: g++ test.cpp && ./a.out

EXPECTED RESULT:

Code prints “Success”

ACTUAL RESULT:

Code prints “Failed”

MODIFICATIONS:

None

ADDITIONAL INFORMATION

Original issue reported as a part of the request: Using SDK via qemu emulation

Note that the problems start from allocating 3GB.

3 Likes

This is not a bug but an unimplemented feature, i.e. 64bit SDK. I’ll mark this as tracked though, as I linked it to the already existing story in our backlog.

2 Likes