Skip to content

scheduler: fix SCHED_DEADLINE upper bound check to reject 2^63 - #2232

Open
Rajkaran-122 wants to merge 1 commit into
containers:mainfrom
Rajkaran-122:issue-2190-sched-deadline-range
Open

Rajkaran-122 wants to merge 1 commit into
containers:mainfrom
Rajkaran-122:issue-2190-sched-deadline-range

Conversation

@Rajkaran-122

@Rajkaran-122 Rajkaran-122 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Per sched(7), SCHED_DEADLINE parameters must be at least 1024 and less than 2^63. The current code uses max = 1ULL << 63 together with a > comparison, which incorrectly accepts a value equal to 2^63.

Change max to (1ULL << 63) - 1 so that the existing range check correctly rejects 2^63 while accepting the maximum valid value.

Keep the existing must be between error messages unchanged.

Add a focused regression test for the specific bug:

  • Reject exactly 2^63 for SCHED_DEADLINE runtime/deadline values.

Fixes #2190

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 271f7b4 to ead13d8 Compare September 3, 2026 11:11
@packit-as-a-service

Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@giuseppe

giuseppe commented Sep 3, 2026

Copy link
Copy Markdown
Member

tests are failing

@eriksjolund PTAL

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from ead13d8 to 88a96d9 Compare September 3, 2026 16:01
Comment thread src/libcrun/scheduler.c
@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 88a96d9 to 6d87085 Compare September 3, 2026 17:13
@eriksjolund

Copy link
Copy Markdown
Contributor

LGTM

(I just reviewed the changes in src/libcrun/scheduler.c‎)

Comment thread src/libcrun/scheduler.c Outdated

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a brief look at the test cases -- and it is ridiculous to have 20+ lines of code to check each and every boundary values.

Maybe the new tests does not make any sense?

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 6d87085 to 11e58bc Compare September 4, 2026 08:29
@kolyshkin

Copy link
Copy Markdown
Collaborator

I took a brief look at the test cases -- and it is ridiculous to have 20+ lines of code to check each and every boundary values.

Maybe the new tests does not make any sense?

@Rajkaran-122 ^^^

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 051e55f to 7b5baa0 Compare September 9, 2026 19:13
@giuseppe

Copy link
Copy Markdown
Member

please apply the fixup and commit the final clean patch

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 7b5baa0 to 115c65d Compare September 10, 2026 16:53
@Rajkaran-122

Copy link
Copy Markdown
Contributor Author

please apply the fixup and commit the final clean patch

@giuseppe sir PTAL .

@kolyshkin

Copy link
Copy Markdown
Collaborator

@Rajkaran-122 you need to squash your commits (as @giuseppe said above).

@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 115c65d to 96dd5b6 Compare September 11, 2026 11:25
@Rajkaran-122

Rajkaran-122 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@Rajkaran-122 you need to squash your commits (as @giuseppe said above).

@kolyshkin @giuseppe sir PTAL .

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's wrong with using the existing test, just decrease its number by one? Why write a new test?

Per sched(7), SCHED_DEADLINE parameters must be at least 1024
and less than 2^63. The current code uses greater than max with max = 2^63,
which incorrectly accepts values equal to 2^63. Change the check to
greater than or equal to max to reject the endpoint as required by the kernel spec.

Add regression test for the specific bug (2^63 rejection).

Fixes containers#2190

Signed-off-by: Rajkaran Yadav <[email protected]>
@Rajkaran-122
Rajkaran-122 force-pushed the issue-2190-sched-deadline-range branch from 96dd5b6 to add48e6 Compare September 12, 2026 07:52
@Rajkaran-122

Rajkaran-122 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@giuseppe sir Could you please rerun the failed wasmedge-build check? I can’t rerun it from my side. The failure appears to be a transient WasmEdge download/network error (Connection reset by peer).

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks

@kolyshkin

Copy link
Copy Markdown
Collaborator

@eriksjolund PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCHED_DEADLINE range check allows value equal to 2^63 (off-by-one vs. cited spec)

4 participants