- On KasperskyOS Community Edition 1.4.0.102 (QEMU, aarch64), the prebuilt VfsRamFs takes an unhandled page fault (a NULL pointer dereference) when several threads of one client create, stat, list and unlink files in /tmp at the same time.
- The kernel then terminates VfsRamFs, so its client loses its file system [VFS_CLIENT] Connection to vfs lost. on every later call).
- A reproducer in plain C (https://github.com/caraioniurie47/kos-vfsramfs-repro) needs only the SDK. With THREADS=4 (12 worker threads) it faulted in the first round in 3 of 3 runs; with THREADS=1 (3 worker threads) both runs completed.
- The call trace points to the release of an inode: _vfs_unlinkat → dentry_free → KosPutObject → inode_destructor, which follows a NULL list node.
One program, repro.Stress, whose file system is the SDK's prebuilt precompiled_vfs::VfsRamFs; the security policy grants everything. In each of 20 rounds it creates 3000 files in each of THREADS directories under /tmp, then per directory one thread stats 6000 names (half never exist), one lists the directory 20 times, and one unlinks the files (every 7th while holding it open). Clone it, then build and run with the SDK's CMake:
THREADS (1-4) is the number of directories stressed at once; each adds three threads (stat, readdir, unlink). The program prints [stress] round N: ... as it goes and [stress] DONE at the end.
Fault report (first THREADS=4 run; some header lines, registers and stack words trimmed):
```
[stress] 4 directories, 3000 files, 12 threads during stat/readdir/unlink
[stress] round 1: create
[stress] round 1: stat + readdir + unlink
[VMM ] Unhandled Page Fault, address: 0x88
Exception class: Data Abort from a lower Exception level
[2026-09-23T21:40:38.060][Error][repro.Stress][16:34][VFS_CLIENT] Connection to vfs lost.
```
Call trace, named. The shipped sysroot-aarch64-kos/bin/VfsRamFs is stripped, so I named the frames by matching the instructions before each return address against the SDK's static libraries, which keep their symbols. Addresses are as the fault report prints them (the relocation base is 0x10000); where a sequence occurs in more than one function, all candidates are listed:
| Address | Function (library) |
|---|---|
| 0xd2a18 … 0xd2ae0 (fault) | inode_destructor (libvfs_fs, libvfs_imp; same instructions as dentry_lru_get) |
| 0xd2e74 | inside inode_new (libvfs_fs) |
| 0xdf790 | near vfs_object_allocator_init (libvfs_local_common): an object's release callback |
The faulting loop walks a list linked at offset 0x80 of each node and reads offsets 0x70 and 0x88; the fault addresses were 0x70 and 0x88, so a node pointer in that list was NULL. The faulting pc varied between runs 0xd2a18, 0xd2a24, 0xd2a74, 0xd2ae0), always inside the same function. In one run the destructor was reached from a different caller 0xdf508, near vfs_notice_init in libvfs_local_common) instead of _vfs_unlinkat. It looks like a race on the inode or dentry lists when the last reference to an inode is dropped, but I can only see it from outside.
Simpler cases did not fault: unlink or rmdir of an open, empty or non-empty directory from one thread, and four threads doing mkdir/open/unlink/close 300 times each. In one run of an earlier version of the stress program (1500 files per directory), there was no fault report; instead the program made no progress for 600 seconds.
Thread limit. The SDK 1.4 page "Limitations and known issues" (https://support.kaspersky.com/kos-community-edition/1.4/limitations_and_known_problems) states: "The libc library API supported by VFS has a limit of 30 VFS clients and 5 threads per client." With THREADS=1 the process has 4 threads, within that limit, and both runs completed all 20 rounds; I have not seen the fault within the limit. With THREADS=4 it has 13. Even so, a client over the limit takes the file system server down rather than getting an error.
Context
Found while running the .NET runtime's System.IO.FileSystem test suite on a KasperskyOS port of .NET (NativeAOT; latest release: https://github.com/caraioniurie47/runtime-kos/releases/tag/release_v03): one of six full runs lost its file system when VfsRamFs faulted with the call trace above. The .NET runtime starts threads of its own (a finalizer thread, and thread pool threads on demand), so a managed app does not control how many of its threads call into VFS, and a limit of 5 threads per VFS client is hard for it to stay within; if a client goes over it, an error would be much easier to handle than a server fault.
Is this a known issue, and is there a workaround until a fix, for example a VfsRamFs setting or a way to serialize requests on the client side?
Summary
- On KasperskyOS Community Edition 1.4.0.102 (QEMU, aarch64), the prebuilt VfsRamFs takes an unhandled page fault (a NULL pointer dereference) when several threads of one client create, stat, list and unlink files in
/tmpat the same time.- The kernel then terminates VfsRamFs, so its client loses its file system
[VFS_CLIENT] Connection to vfs lost.on every later call).- A reproducer in plain C (https://github.com/caraioniurie47/kos-vfsramfs-repro) needs only the SDK. With
THREADS=4(12 worker threads) it faulted in the first round in 3 of 3 runs; withTHREADS=1(3 worker threads) both runs completed.- The call trace points to the release of an inode:
_vfs_unlinkat→dentry_free→KosPutObject→inode_destructor, which follows a NULL list node.Reproducer: https://github.com/caraioniurie47/kos-vfsramfs-repro
One program,
repro.Stress, whose file system is the SDK's prebuiltprecompiled_vfs::VfsRamFs; the security policy grants everything. In each of 20 rounds it creates 3000 files in each ofTHREADSdirectories under/tmp, then per directory one threadstats 6000 names (half never exist), one lists the directory 20 times, and one unlinks the files (every 7th while holding it open). Clone it, then build and run with the SDK's CMake:```
git clone https://github.com/caraioniurie47/kos-vfsramfs-repro.git
cd kos-vfsramfs-repro
$SDK/toolchain/bin/cmake -B build -D CMAKE_TOOLCHAIN_FILE=$SDK/toolchain/share/toolchain-aarch64-kos.cmake -D THREADS=4
$SDK/toolchain/bin/cmake --build build --target sim
```
THREADS(1-4) is the number of directories stressed at once; each adds three threads (stat, readdir, unlink). The program prints[stress] round N: ...as it goes and[stress] DONEat the end.Fault report (first
THREADS=4run; some header lines, registers and stack words trimmed):```
[stress] 4 directories, 3000 files, 12 threads during stat/readdir/unlink
[stress] round 1: create
[stress] round 1: stat + readdir + unlink
[VMM ] Unhandled Page Fault, address: 0x88
Exception class: Data Abort from a lower Exception level
Access type: read
Fault type: L3 Translation fault
EIID : kl.VfsRamFs
Path : VfsRamFs
TID : 30
pc : 0xd2a74
sp: 0x000000000192ac40, lr: 0x00000000000d290c, pc: 0x00000000000d2a74
Relocation base: <0x0000000000010000>
Call Trace (User Mode):
[<0x00000000000d2a74>] ???
[<0x00000000000d2e74>] ???
[<0x00000000000df790>] ???
[<0x00000000000f9094>] ???
[<0x00000000000f902c>] ???
[<0x00000000000cf598>] ???
[<0x00000000000d7bb0>] ???
[<0x0000000000093ba8>] ???
[<0x00000000000af9c8>] ???
[<0x00000000000ae55c>] ???
[<0x00000000001b31e4>] ???
Terminating task.
Terminating thread.
[2026-09-23T21:40:38.060][Error][repro.Stress][16:34][VFS_CLIENT] Connection to vfs lost.
```
Call trace, named. The shipped
sysroot-aarch64-kos/bin/VfsRamFsis stripped, so I named the frames by matching the instructions before each return address against the SDK's static libraries, which keep their symbols. Addresses are as the fault report prints them (the relocation base is 0x10000); where a sequence occurs in more than one function, all candidates are listed:| Address | Function (library) |
|---|---|
|
0xd2a18…0xd2ae0(fault) |inode_destructor(libvfs_fs, libvfs_imp; same instructions asdentry_lru_get) ||
0xd2e74| insideinode_new(libvfs_fs) ||
0xdf790| nearvfs_object_allocator_init(libvfs_local_common): an object's release callback ||
0xf9094,0xf902c|KosPutObject(libkos) ||
0xcf598|dentry_free(or_vfs_getdents_filldir,dentry_read_root) (libvfs_fs) ||
0xd7bb0|_vfs_unlinkat(libvfs_fs) ||
0x93ba8,0xaf9c8| request dispatch (libvfs_server) |The faulting loop walks a list linked at offset 0x80 of each node and reads offsets 0x70 and 0x88; the fault addresses were
0x70and0x88, so a node pointer in that list was NULL. The faulting pc varied between runs0xd2a18,0xd2a24,0xd2a74,0xd2ae0), always inside the same function. In one run the destructor was reached from a different caller0xdf508, nearvfs_notice_initin libvfs_local_common) instead of_vfs_unlinkat. It looks like a race on the inode or dentry lists when the last reference to an inode is dropped, but I can only see it from outside.Simpler cases did not fault: unlink or rmdir of an open, empty or non-empty directory from one thread, and four threads doing mkdir/open/unlink/close 300 times each. In one run of an earlier version of the stress program (1500 files per directory), there was no fault report; instead the program made no progress for 600 seconds.
Thread limit. The SDK 1.4 page "Limitations and known issues" (https://support.kaspersky.com/kos-community-edition/1.4/limitations_and_known_problems) states: "The libc library API supported by VFS has a limit of 30 VFS clients and 5 threads per client." With
THREADS=1the process has 4 threads, within that limit, and both runs completed all 20 rounds; I have not seen the fault within the limit. WithTHREADS=4it has 13. Even so, a client over the limit takes the file system server down rather than getting an error.Context
Found while running the .NET runtime's System.IO.FileSystem test suite on a KasperskyOS port of .NET (NativeAOT; latest release: https://github.com/caraioniurie47/runtime-kos/releases/tag/release_v03): one of six full runs lost its file system when VfsRamFs faulted with the call trace above. The .NET runtime starts threads of its own (a finalizer thread, and thread pool threads on demand), so a managed app does not control how many of its threads call into VFS, and a limit of 5 threads per VFS client is hard for it to stay within; if a client goes over it, an error would be much easier to handle than a server fault.
Is this a known issue, and is there a workaround until a fix, for example a VfsRamFs setting or a way to serialize requests on the client side?
Thanks!