diff options
-rwxr-xr-x | pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go | 4 | ||||
-rwxr-xr-x | pkg/sentry/platform/ring0/defs_impl.go | 8 | ||||
-rwxr-xr-x | pkg/sentry/time/seqatomic_parameters_unsafe.go | 4 | ||||
-rw-r--r-- | pkg/tcpip/network/arp/arp.go | 1 | ||||
-rw-r--r-- | runsc/container/container.go | 24 |
5 files changed, 14 insertions, 27 deletions
diff --git a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go index 25ad17a4e..24528b66a 100755 --- a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go +++ b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go @@ -1,12 +1,12 @@ package kernel import ( - "fmt" - "reflect" "strings" "unsafe" + "fmt" "gvisor.dev/gvisor/third_party/gvsync" + "reflect" ) // SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race diff --git a/pkg/sentry/platform/ring0/defs_impl.go b/pkg/sentry/platform/ring0/defs_impl.go index d4bfc5a4a..acae012dc 100755 --- a/pkg/sentry/platform/ring0/defs_impl.go +++ b/pkg/sentry/platform/ring0/defs_impl.go @@ -1,14 +1,14 @@ package ring0 import ( - "syscall" - "fmt" "gvisor.dev/gvisor/pkg/cpuid" - "gvisor.dev/gvisor/pkg/sentry/platform/ring0/pagetables" - "gvisor.dev/gvisor/pkg/sentry/usermem" "io" "reflect" + "syscall" + + "gvisor.dev/gvisor/pkg/sentry/platform/ring0/pagetables" + "gvisor.dev/gvisor/pkg/sentry/usermem" ) var ( diff --git a/pkg/sentry/time/seqatomic_parameters_unsafe.go b/pkg/sentry/time/seqatomic_parameters_unsafe.go index 89792c56d..fb30a22c6 100755 --- a/pkg/sentry/time/seqatomic_parameters_unsafe.go +++ b/pkg/sentry/time/seqatomic_parameters_unsafe.go @@ -1,12 +1,12 @@ package time import ( - "fmt" - "reflect" "strings" "unsafe" + "fmt" "gvisor.dev/gvisor/third_party/gvsync" + "reflect" ) // SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go index 60070874d..ea7296e6a 100644 --- a/pkg/tcpip/network/arp/arp.go +++ b/pkg/tcpip/network/arp/arp.go @@ -109,6 +109,7 @@ func (e *endpoint) HandlePacket(r *stack.Route, vv buffer.VectorisedView) { pkt.SetOp(header.ARPReply) copy(pkt.HardwareAddressSender(), r.LocalLinkAddress[:]) copy(pkt.ProtocolAddressSender(), h.ProtocolAddressTarget()) + copy(pkt.HardwareAddressTarget(), h.HardwareAddressSender()) copy(pkt.ProtocolAddressTarget(), h.ProtocolAddressSender()) e.linkEP.WritePacket(r, nil /* gso */, hdr, buffer.VectorisedView{}, ProtocolNumber) fallthrough // also fill the cache from requests diff --git a/runsc/container/container.go b/runsc/container/container.go index 2a8453931..bbb364214 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -1176,30 +1176,16 @@ func (c *Container) adjustOOMScoreAdj(conf *boot.Config) error { return nil } - // Set oom_score_adj for the sandbox. + // Set the lowest of all containers oom_score_adj to the sandbox. if err := setOOMScoreAdj(c.Sandbox.Pid, lowScore); err != nil { return fmt.Errorf("setting oom_score_adj for sandbox %q: %v", c.Sandbox.ID, err) } - // Set the gofer's oom_score_adj to the minimum of -500 and the - // sandbox's oom_score_adj to better ensure that the sandbox is killed - // before the gofer. - // - // TODO(gvisor.dev/issue/601) Set oom_score_adj for the gofer to - // the same oom_score_adj as the sandbox. - goferScoreAdj := -500 - if lowScore < goferScoreAdj { - goferScoreAdj = lowScore + // Set container's oom_score_adj to the gofer since it is dedicated to the + // container, in case the gofer uses up too much memory. + if err := setOOMScoreAdj(c.GoferPid, *c.Spec.Process.OOMScoreAdj); err != nil { + return fmt.Errorf("setting gofer oom_score_adj for container %q: %v", c.ID, err) } - - // Set oom_score_adj for gofers for all containers in the sandbox. - for _, container := range containers { - err := setOOMScoreAdj(container.GoferPid, goferScoreAdj) - if err != nil { - return fmt.Errorf("setting oom_score_adj for container %q: %v", container.ID, err) - } - } - return nil } |