diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-01-16 20:43:14 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-16 20:43:14 +0000 |
commit | 04d906d01293b63764895be93e50af1d65adb8ed (patch) | |
tree | 255740acbd0442ef8d5349e085e467080be94c68 /pkg/sentry | |
parent | 08beb206526f64799d9458cc970203977f931080 (diff) | |
parent | 7b7c31820b83abcfe43f7170eff1f7953f3f27e2 (diff) |
Merge release-20200115.0-8-g7b7c318 (automated)
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/fs/proc/cpuinfo.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/fs/proc/cpuinfo.go b/pkg/sentry/fs/proc/cpuinfo.go index 3edf36780..6330337eb 100644 --- a/pkg/sentry/fs/proc/cpuinfo.go +++ b/pkg/sentry/fs/proc/cpuinfo.go @@ -15,6 +15,8 @@ package proc import ( + "bytes" + "gvisor.dev/gvisor/pkg/sentry/context" "gvisor.dev/gvisor/pkg/sentry/fs" "gvisor.dev/gvisor/pkg/sentry/kernel" @@ -27,9 +29,9 @@ func newCPUInfo(ctx context.Context, msrc *fs.MountSource) *fs.Inode { // Kernel is always initialized with a FeatureSet. panic("cpuinfo read with nil FeatureSet") } - contents := make([]byte, 0, 1024) + var buf bytes.Buffer for i, max := uint(0), k.ApplicationCores(); i < max; i++ { - contents = append(contents, []byte(features.CPUInfo(i))...) + features.WriteCPUInfoTo(i, &buf) } - return newStaticProcInode(ctx, msrc, contents) + return newStaticProcInode(ctx, msrc, buf.Bytes()) } |