mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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
This commit is contained in:
@@ -54,6 +54,15 @@ type filesystem struct {
|
||||
devMinor uint32
|
||||
}
|
||||
|
||||
func (fs *filesystem) StatFSAt(ctx context.Context, rp *vfs.ResolvingPath) (linux.Statfs, error) {
|
||||
d, err := fs.GetDentryAt(ctx, rp, vfs.GetDentryOptions{})
|
||||
if err != nil {
|
||||
return linux.Statfs{}, err
|
||||
}
|
||||
d.DecRef(ctx)
|
||||
return vfs.GenericStatFS(linux.PROC_SUPER_MAGIC), nil
|
||||
}
|
||||
|
||||
// GetFilesystem implements vfs.FilesystemType.GetFilesystem.
|
||||
func (ft FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, source string, opts vfs.GetFilesystemOptions) (*vfs.Filesystem, *vfs.Dentry, error) {
|
||||
k := kernel.KernelFromContext(ctx)
|
||||
|
||||
@@ -72,11 +72,15 @@ func (fs *filesystem) newTasksInode(ctx context.Context, k *kernel.Kernel, pidns
|
||||
"filesystems": fs.newInode(ctx, root, 0444, &filesystemsData{}),
|
||||
"loadavg": fs.newInode(ctx, root, 0444, &loadavgData{}),
|
||||
"sys": fs.newSysDir(ctx, root, k),
|
||||
"bus": fs.newStaticDir(ctx, root, map[string]kernfs.Inode{}),
|
||||
"fs": fs.newStaticDir(ctx, root, map[string]kernfs.Inode{}),
|
||||
"irq": fs.newStaticDir(ctx, root, map[string]kernfs.Inode{}),
|
||||
"meminfo": fs.newInode(ctx, root, 0444, &meminfoData{}),
|
||||
"mounts": kernfs.NewStaticSymlink(ctx, root, linux.UNNAMED_MAJOR, fs.devMinor, fs.NextIno(), "self/mounts"),
|
||||
"net": kernfs.NewStaticSymlink(ctx, root, linux.UNNAMED_MAJOR, fs.devMinor, fs.NextIno(), "self/net"),
|
||||
"sentry-meminfo": fs.newInode(ctx, root, 0444, &sentryMeminfoData{}),
|
||||
"stat": fs.newInode(ctx, root, 0444, &statData{}),
|
||||
"sysrq-trigger": fs.newInode(ctx, root, 0200, newStaticFile("")),
|
||||
"uptime": fs.newInode(ctx, root, 0444, &uptimeData{}),
|
||||
"version": fs.newInode(ctx, root, 0444, &versionData{}),
|
||||
}
|
||||
|
||||
@@ -47,9 +47,12 @@ var (
|
||||
|
||||
var (
|
||||
tasksStaticFiles = map[string]testutil.DirentType{
|
||||
"bus": linux.DT_DIR,
|
||||
"cmdline": linux.DT_REG,
|
||||
"cpuinfo": linux.DT_REG,
|
||||
"filesystems": linux.DT_REG,
|
||||
"fs": linux.DT_DIR,
|
||||
"irq": linux.DT_DIR,
|
||||
"loadavg": linux.DT_REG,
|
||||
"meminfo": linux.DT_REG,
|
||||
"mounts": linux.DT_LNK,
|
||||
@@ -58,6 +61,7 @@ var (
|
||||
"sentry-meminfo": linux.DT_REG,
|
||||
"stat": linux.DT_REG,
|
||||
"sys": linux.DT_DIR,
|
||||
"sysrq-trigger": linux.DT_REG,
|
||||
"thread-self": linux.DT_LNK,
|
||||
"uptime": linux.DT_REG,
|
||||
"version": linux.DT_REG,
|
||||
|
||||
Reference in New Issue
Block a user