Do not cast -1 to uint64 in EnableKernelMemoryAccounting #1493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a runc bug that is very annoying on kernels such as RHEL 7.2
that have the following bug: when setting memory.kmem.limit_in_bytes to
a bigger value than the default max value (bigger than 2^63-1), the
buggy kernel sets it to 0, instead of setting it to the max value. This
results in the process being unable to run with a 0 byte limit on kmem.
That kernel bug exposes a runc bug introduced in 8430cc4, that casted an
int64(-1) to uint64 in EnableKernelMemoryAccounting, which is called
every time the user specifies any memory-related cgroup setting as
determined by the memoryAssigned function.
This patch is the smallest fix for this clearly unwanted behavior.
Reverting 8430cc4, although desirable because int64 values are casted to
uint64 in many other places introducing similar bugs, it is out of scope
for this patch since it would require a spec change.
Signed-off-by: Tibor Vass [email protected]
Related #1492 #1375
cc @crosbymichael @justincormack @tonistiigi @hqhq