Skip to content

[asan] NPD calling prctl with PR_SET_VMA PR_SET_VMA_ANON_NAME and nullptr for name #160562

@nickdesaulniers

Description

@nickdesaulniers
unsigned long name = reinterpret_cast<unsigned long>(nullptr);
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, name);

will crash in internal_strlen called from the prctl asan interceptor.

man 2 prctl states:

PR_SET_VMA (since Linux 5.17)
PR_SET_VMA_ANON_NAME
If arg5 is NULL, the name of the appropriate anonymous virtual memory areas will be re‐set.

So it is valid and expected to be able to call prctl with the 5th parameter set to NULL. It's UB to call strlen with NULL; and in this case, internal_strlen immediately dereferences the pointer it's given.

a4c97e1

cc @vitalybuka @eugenis @devnexen

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions