thc1006 opened a new pull request, #1053: URL: https://github.com/apache/yunikorn-k8shim/pull/1053
### What is this PR for? `GetTGResource` (`pkg/common/resource.go`) builds the gang task-group placeholder ask as `members * MinResource` with an unchecked `int64` multiply. Both operands come unbounded from the `yunikorn.apache.org/task-groups` pod annotation: `GetTaskGroupsFromAnnotation` only rejects `minMember == 0` and `minMember < 0`, and nothing bounds `minResource`. A large `minMember` or `minResource` overflows the multiply and wraps the placeholder ask to a negative value, which is then sent to the core as `AddApplicationRequest.PlaceholderAsk`. This saturates the multiply to `MaxInt64`/`MinInt64` instead of wrapping, so the placeholder ask stays non-negative. ### What type of PR is it? - [x] - Bug Fix ### Todos - [ ] - Link the YUNIKORN Jira. GitHub issues are disabled for this repository, so this needs a Jira ticket; I have requested an ASF Jira account and will update the title to `[YUNIKORN-XXXX]` and link the ticket once it is approved. Opening as a draft to share the fix meanwhile. ### What is the Jira issue? Pending. ASF Jira account requested via https://selfserve.apache.org/jira-account.html; will link the YUNIKORN issue once approved. ### How should this be tested? `GOWORK=off GOFLAGS=-mod=mod go test ./pkg/common/ -run TestGetTGResource` A new `TestGetTGResource` case (`members = 2000000000`, cpu `5000000` so `MilliValue() = 5000000000`) returns `MaxInt64` after the change; before it, the same input wraps to a negative value. ### Questions: - [ ] - The licenses files need update. - [ ] - There is breaking changes for older versions. - [ ] - It needs documentation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
