Skip to content

why scudo killed the process due to out of memory #118735

Open
@jiangenj

Description

@jiangenj

Hi,
I have the poc code which limit RLIMIT_AS to 200MB, but when it executes on arm64 android platform, scudo killed while the same code runs well on amd64 linux platform like ubuntu.
I want to understand why setting RLIMIT_AS failed and how to overcome it with smaller RLIMIT_AS.

code

#include <sys/time.h>
#include <sys/resource.h>
#include <stdlib.h>

int main(int argc, char** argv)
{
        struct rlimit rlim;
        rlim.rlim_cur = rlim.rlim_max = (200 << 20);
        setrlimit(RLIMIT_AS, &rlim);
        system("ls -l /");

        return 0;
}

build

android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang -static test.c

run

/data/local/tmp/a.out

logcat -b crash

--------- beginning of crash
11-14 17:19:17.258 13778 13778 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13778 (sh), pid 13778 (sh)
11-14 17:19:17.315 13780 13780 I scudo   : Scudo ERROR: internal map failure (error desc=Out of memory) requesting 8650752KB
11-14 17:19:17.315 13780 13780 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13780 (crash_dump64), pid 13780 (crash_dump64)
11-14 17:19:17.354 13782 13782 I scudo   : Scudo ERROR: internal map failure (error desc=Out of memory) requesting 8650752KB

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions