Skip to content

doublemapping.cpp causes crash with SIGXFSZ if file size limits <2TB are in effect #117819

@djast

Description

@djast

Description

src/coreclr/minipal/Unix/doublemapping.cpp does:

if (ftruncate(fd, MaxDoubleMappedSize) == -1)

where

#ifdef TARGET_64BIT
static const off_t MaxDoubleMappedSize = 2048ULL10241024*1024;
#else
static const off_t MaxDoubleMappedSize = UINT_MAX;
#endif

This causes the process to fail with SIGXFSZ if a file size limit has been imposed via setrlimit()/prlimit().

Reproduction Steps

Set a file size limit (e.g., "ulimit -S -f 25165824" from bash).
Run any program which invokes VMToOSInterface::CreateDoubleMemoryMapper().

Expected behavior

Process continues normally.

Actual behavior

Process dies with SIGXFSZ.

Regression?

Issue was observed in the Visual Studio Code C/C++ extension; problem occurs in ms-vscode.cpptools-1.23.5-linux-x64 but was not present in ms-vscode.cpptools-1.22.11-linux-x64 (cf. microsoft/vscode-cpptools#13768).
See also microsoft/vscode#251037 , in VS Code's vsce-sign program.
I presume these projects are embedding their libmscordaccore.so libraries from dotnet/runtime.

Known Workarounds

No response

Configuration

AlmaLinux 8.10 x86_64.

Other information

Issue could be addressed by calling getrlimit(RLIMIT_FSIZE) and capping the parameter to ftruncate() at the soft limit.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions