diff options
-rw-r--r-- | pkg/sentry/fs/proc/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/fs/proc/task.go | 7 | ||||
-rw-r--r-- | test/syscalls/linux/proc.cc | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/pkg/sentry/fs/proc/BUILD b/pkg/sentry/fs/proc/BUILD index 666b0ab3a..3aa70a28e 100644 --- a/pkg/sentry/fs/proc/BUILD +++ b/pkg/sentry/fs/proc/BUILD @@ -42,6 +42,7 @@ go_library( "//pkg/sentry/kernel/auth", "//pkg/sentry/kernel/kdefs", "//pkg/sentry/kernel/time", + "//pkg/sentry/limits", "//pkg/sentry/mm", "//pkg/sentry/socket/rpcinet", "//pkg/sentry/socket/unix", diff --git a/pkg/sentry/fs/proc/task.go b/pkg/sentry/fs/proc/task.go index 335003dd8..5a90c5578 100644 --- a/pkg/sentry/fs/proc/task.go +++ b/pkg/sentry/fs/proc/task.go @@ -29,6 +29,7 @@ import ( "gvisor.googlesource.com/gvisor/pkg/sentry/fs/proc/seqfile" "gvisor.googlesource.com/gvisor/pkg/sentry/fs/ramfs" "gvisor.googlesource.com/gvisor/pkg/sentry/kernel" + "gvisor.googlesource.com/gvisor/pkg/sentry/limits" "gvisor.googlesource.com/gvisor/pkg/sentry/mm" "gvisor.googlesource.com/gvisor/pkg/sentry/usage" "gvisor.googlesource.com/gvisor/pkg/sentry/usermem" @@ -477,7 +478,11 @@ func (s *taskStatData) ReadSeqFileData(ctx context.Context, h seqfile.SeqHandle) } }) fmt.Fprintf(&buf, "%d %d ", vss, rss/usermem.PageSize) - fmt.Fprintf(&buf, "0 0 0 0 0 0 " /* rsslim startcode endcode startstack kstkesp kstkeip */) + + // rsslim. + fmt.Fprintf(&buf, "%d ", s.t.ThreadGroup().Limits().Get(limits.Rss).Cur) + + fmt.Fprintf(&buf, "0 0 0 0 0 " /* startcode endcode startstack kstkesp kstkeip */) fmt.Fprintf(&buf, "0 0 0 0 0 " /* signal blocked sigignore sigcatch wchan */) fmt.Fprintf(&buf, "0 0 " /* nswap cnswap */) terminationSignal := linux.Signal(0) diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index 64d75d9fb..5b52ed71a 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -895,6 +895,10 @@ TEST_P(ProcPidStatTest, HasBasicFields) { uint64_t rss; ASSERT_TRUE(absl::SimpleAtoi(fields[23], &rss)); EXPECT_GT(rss, 0); + + uint64_t rsslim; + ASSERT_TRUE(absl::SimpleAtoi(fields[24], &rsslim)); + EXPECT_GT(rsslim, 0); } INSTANTIATE_TEST_CASE_P(SelfAndNumericPid, ProcPidStatTest, |