kubernetes: Crash in TestGetContainerOOMScoreAdjust

Which jobs are failing?

pkg/kubelet/qos

Which tests are failing?

TestGetContainerOOMScoreAdjust in pkg/kubelet/qos I transformed that testcase into a fuzz driver and tested it with [go-fuzz](https://github.com/dvyukov/go-fuzz) It crash with “integer divide by zero” when some argument related data are fuzzed.

Since when has it been failing?

Always

Testgrid link

No response

Reason for failure (if possible)

No response

Anything else we need to know?

Simplified PoC code is here:

	test := oomTest{
		pod:             &cpuLimit,
		memoryCapacity:  0,
		lowOOMScoreAdj:  999,
		highOOMScoreAdj: 999,
	}
	GetContainerOOMScoreAdjust(test.pod, &test.pod.Spec.Containers[0], test.memoryCapacity)

and it crashed as:

panic: runtime error: integer divide by zero [recovered]
	panic: runtime error: integer divide by zero

goroutine 19 [running]:
testing.tRunner.func1.2({0xaf6ea0, 0x11714b0})
	/home/gogen/.local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
	/home/gogen/.local/go/src/testing/testing.go:1212 +0x218
panic({0xaf6ea0, 0x11714b0})
	/home/gogen/.local/go/src/runtime/panic.go:1038 +0x215
k8s.io/kubernetes/pkg/kubelet/qos.GetContainerOOMScoreAdjust(0x1179620, 0x11856e0, 0x0)
	/home/gogen/workspace/gowork/src/topproj/kubernetes/pkg/kubelet/qos/policy.go:63 +0x2d5
k8s.io/kubernetes/pkg/kubelet/qos.FuzzTestGetContainerOOMScoreAdjust({0xc000230400, 0x0, 0x200})
	/home/gogen/workspace/gowork/src/topproj/kubernetes/pkg/kubelet/qos/policy_test.go_TestGetContainerOOMScoreAdjust_test.go:79 +0x2b5

Relevant SIG(s)

/sig

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 18 (14 by maintainers)

Most upvoted comments

Sure, feel free to take it. /assign @fatsheep9146