164 Commits

Author SHA1 Message Date
gVisor bot 86abc85f37 Merge pull request #11473 from Champ-Goblem:shim-add-cgroup-v2-metrics-support
PiperOrigin-RevId: 730560110
2025-02-25 14:52:09 -08:00
Andrei Vagin 679c77e4f0 proc: Allow interrupting generation of /proc/pid/mount{s,info}
In some cases, generating /proc/pid/mount{s,info} can take a long time.
This change allows the process to be interrupted.

Reported-by: syzbot+9e7465bc6f00665727ad@syzkaller.appspotmail.com
Signed-off-by: Andrei Vagin <avagin@google.com>
2025-01-06 14:02:17 -08:00
Fabricio Voznika fb730ff784 Remove checkpoint_count from runsc wait --checkpoint
This is done because external callers are not able to know
the snapshot generation number from the outside.

PiperOrigin-RevId: 707979556
2024-12-19 11:48:10 -08:00
Andrei Vagin 9fcf0b5b53 proc: invalidate task inodes when tasks are destroyed
PiperOrigin-RevId: 705785809
2024-12-13 00:58:08 -08:00
Jamie Liu e23347e5b5 Move //pkg/sentry/kernel/time to //pkg/sentry/ktime.
This avoids needing to rename it everywhere it's imported.

PiperOrigin-RevId: 693930089
2024-11-06 18:13:51 -08:00
Peyton Walters 60909dcb39 Implement /proc/sys/kernel/pid_max with TasksLimit
Previously, /proc/sys/kernel/pid_max did not exist in sandboxes, making
some processes which depend on it fail. This commit populates it with
kernel.TasksLimit.
2024-11-05 16:37:48 +00:00
Fabricio Voznika d4e733ac17 Add a few extension points
PiperOrigin-RevId: 644476039
2024-06-18 12:31:58 -07:00
Jing Chen 79331f35cf Create utility for integer-based proc files.
PiperOrigin-RevId: 635890464
2024-05-21 12:26:14 -07:00
Jing Chen 4a8e821f8b Remove Logf from unit tests.
PiperOrigin-RevId: 633110930
2024-05-13 00:16:02 -07:00
Jamie Liu f84a013407 procfs: add topology-related x86 cpuinfo fields
Linux prints these fields when the kernel is built with support for multiple
processors/cores (CONFIG_SMP), in
arch/x86/kernel/cpu/proc.c:show_cpuinfo_core().

Fixes #10205

PiperOrigin-RevId: 632621375
2024-05-10 15:46:45 -07:00
Jamie Liu a78cff7f8d kernfs: invalidate descendants of dentries failing revalidation
Adapted from cl/630063475.

This causes FUSE tests involving submounts to fail, because fuse.inode.Valid()
just returns false (fails revalidation) after the entry time expires, causing
all submounts to be unmounted; change it to perform revalidation instead, a la
Linux's fs/fuse/dir.c:fuse_dentry_revalidate(). This in turn requires that we
plumb the dentry's parent and name through kernfs.Inode.Valid().

PiperOrigin-RevId: 630476483
2024-05-03 13:13:36 -07:00
Jamie Liu 2846aacb51 Implement /proc/sys/kernel/random/boot_id.
If libnccl.so.2:getHostHash() fails to fopen(/proc/sys/kernel/random/boot_id),
it calls fclose(NULL) and takes SIGSEGV.

Updates #9827

PiperOrigin-RevId: 592899854
2023-12-21 10:44:09 -08:00
gVisor bot 4e94fff110 Merge pull request #9669 from thundergolfer:master
PiperOrigin-RevId: 580933817
2023-11-09 09:31:14 -08:00
Jonathon Belotti 0c99e86f01 provide (read only) /proc/sys/kernel/overflowuid and overflowgid 2023-11-09 16:15:17 +00:00
Andrei Vagin 68cdc88378 Implement the fs.nr_open sysctl
fs/nr_open limits the maximum size of fdtable-s.

PiperOrigin-RevId: 580795874
2023-11-08 23:41:32 -08:00
Andrei Vagin 65e518c741 proc: limit a comm len to TASK_COMM_LEN
PiperOrigin-RevId: 580532321
2023-11-08 07:50:23 -08:00
Andrei Vagin 5f4abad306 Fix a few typos
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-25 12:13:42 -07:00
Nayana Bidari 0fd906d7e0 Fix the sandbox memory usage via GetContainerMemoryUsage API.
The total(sandbox) memory usage using the GetContainerMemoryUsage API will
return incorrect usage when called before calling the API for each individual
containers in the sandbox. This is because the memory usage for the containers
cgroup is not updated while calculating the total usage. This CL fixes it by
updating the usage for every child cgroup, which will return the correct memory
usage for the parent cgroup.

PiperOrigin-RevId: 574300913
2023-10-17 16:44:07 -07:00
Andrei Vagin d3b19e9484 proc: add /proc/{bus,fs,irq,sysrq-trigger}
Docker fails starting a container without these paths. All of them are
enumerated in readonlyPaths of a container spec.

PiperOrigin-RevId: 559984658
2023-08-24 22:59:41 -07:00
Andrei Vagin 62fae30016 proc: add /proc/sys/kernel/cap_last_cap
PiperOrigin-RevId: 559932636
2023-08-24 18:29:31 -07:00
Andrei Vagin eb6b3ac00b vfs: MountNamespace.Root() has to return a top mount of /
A few mounts can be mounted on top of `/`.

PiperOrigin-RevId: 558264274
2023-08-18 15:35:47 -07:00
Nayana Bidari b056ed871f Add GetMemoryUsage() API to the gVisor sandbox.
Adds GetMemoryUsage() API to get the memory usage of the containers.

PiperOrigin-RevId: 557923509
2023-08-17 13:43:56 -07:00
Shambhavi Srivastava 3657484eee Adding /proc/[pid]/task/[tid]/children
PiperOrigin-RevId: 557888186
2023-08-17 11:41:48 -07:00
Jing Chen e89e40fded Implement setns CLONE_NEWUTS namespace type.
PiperOrigin-RevId: 554306089
2023-08-06 15:33:25 -07:00
Andrei Vagin aa2c8c33c6 Implement setns for mount namespaces
PiperOrigin-RevId: 552859231
2023-08-01 11:12:29 -07:00