summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r--pkg/sentry/fs/proc/proc_state_autogen.go22
-rw-r--r--pkg/sentry/fs/proc/sys.go22
2 files changed, 44 insertions, 0 deletions
diff --git a/pkg/sentry/fs/proc/proc_state_autogen.go b/pkg/sentry/fs/proc/proc_state_autogen.go
index 64f9b1da3..8046c8bf9 100644
--- a/pkg/sentry/fs/proc/proc_state_autogen.go
+++ b/pkg/sentry/fs/proc/proc_state_autogen.go
@@ -729,6 +729,27 @@ func (o *overcommitMemory) afterLoad() {}
func (o *overcommitMemory) StateLoad(stateSourceObject state.Source) {
}
+func (m *maxMapCount) StateTypeName() string {
+ return "pkg/sentry/fs/proc.maxMapCount"
+}
+
+func (m *maxMapCount) StateFields() []string {
+ return []string{}
+}
+
+func (m *maxMapCount) beforeSave() {}
+
+// +checklocksignore
+func (m *maxMapCount) StateSave(stateSinkObject state.Sink) {
+ m.beforeSave()
+}
+
+func (m *maxMapCount) afterLoad() {}
+
+// +checklocksignore
+func (m *maxMapCount) StateLoad(stateSourceObject state.Source) {
+}
+
func (h *hostname) StateTypeName() string {
return "pkg/sentry/fs/proc.hostname"
}
@@ -1773,6 +1794,7 @@ func init() {
state.Register((*statData)(nil))
state.Register((*mmapMinAddrData)(nil))
state.Register((*overcommitMemory)(nil))
+ state.Register((*maxMapCount)(nil))
state.Register((*hostname)(nil))
state.Register((*hostnameFile)(nil))
state.Register((*tcpMemInode)(nil))
diff --git a/pkg/sentry/fs/proc/sys.go b/pkg/sentry/fs/proc/sys.go
index b998fb75d..085aa6d61 100644
--- a/pkg/sentry/fs/proc/sys.go
+++ b/pkg/sentry/fs/proc/sys.go
@@ -77,6 +77,27 @@ func (*overcommitMemory) ReadSeqFileData(ctx context.Context, h seqfile.SeqHandl
}, 0
}
+// +stateify savable
+type maxMapCount struct{}
+
+// NeedsUpdate implements seqfile.SeqSource.
+func (*maxMapCount) NeedsUpdate(int64) bool {
+ return true
+}
+
+// ReadSeqFileData implements seqfile.SeqSource.
+func (*maxMapCount) ReadSeqFileData(ctx context.Context, h seqfile.SeqHandle) ([]seqfile.SeqData, int64) {
+ if h != nil {
+ return nil, 0
+ }
+ return []seqfile.SeqData{
+ {
+ Buf: []byte("2147483647\n"),
+ Handle: (*maxMapCount)(nil),
+ },
+ }, 0
+}
+
func (p *proc) newKernelDir(ctx context.Context, msrc *fs.MountSource) *fs.Inode {
h := hostname{
SimpleFileInode: *fsutil.NewSimpleFileInode(ctx, fs.RootOwner, fs.FilePermsFromMode(0444), linux.PROC_SUPER_MAGIC),
@@ -96,6 +117,7 @@ func (p *proc) newKernelDir(ctx context.Context, msrc *fs.MountSource) *fs.Inode
func (p *proc) newVMDir(ctx context.Context, msrc *fs.MountSource) *fs.Inode {
children := map[string]*fs.Inode{
+ "max_map_count": seqfile.NewSeqFileInode(ctx, &maxMapCount{}, msrc),
"mmap_min_addr": seqfile.NewSeqFileInode(ctx, &mmapMinAddrData{p.k}, msrc),
"overcommit_memory": seqfile.NewSeqFileInode(ctx, &overcommitMemory{}, msrc),
}