8000 Reject negative scheduling options and integer overflow in delay and clock calculations. by copybara-service[bot] · Pull Request #5359 · google/xls · GitHub
[go: up one dir, main page]

Skip to content

Reject negative scheduling options and integer overflow in delay and clock calculations. - #5359

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1019401266
Draft

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1019401266

Conversation

@copybara-service
@copybara-service copybara-service Bot commented Nov 11, 2026 •
Copy link
Copy Markdown

Reject negative scheduling options and integer overflow in delay and clock calculations.

When SchedulingOptions has negative or extreme int64_t values (for example from fuzzing NoFdoSchedulingOptionsFlagsDomain), negative delays or signed integer overflow when adding path delays, additional_input_delay_ps, additional_output_delay_ps, clock_period_ps, or computing clock_margin_percent / period_relaxation_percent can cause UB or invalid schedules.

  • Reject negative delay/margin/relaxation/throughput options and non-positive clock_period_ps / pipeline_stages with absl::InvalidArgumentError in OptionsFromFlagProto (xls/scheduling/scheduling_options.cc) and RunPipelineSchedule (xls/scheduling/run_pipeline_schedule.cc).
  • Detect int64_t overflow via SaturatingAdd(...).did_overflow (and negative node delays) and return absl::InvalidArgumentError instead of saturating in SDCScheduler, ScheduleBounds, PipelineSchedule::VerifyTiming, and RunPipelineSchedule.
  • Update DecoratingDelayEstimator (xls/estimators/delay_model/delay_estimator.h) to accept absl::AnyInvocable<absl::StatusOr<int64_t>(Node*, int64_t) const> so io_delay_added in RunPipelineSchedule can return absl::InvalidArgumentError on negative delays or int64_t overflow.
  • Use absl::int128 for intermediate products when applying clock_margin_percent and period_relaxation_percent in RunPipelineSchedule, returning absl::InvalidArgumentError if the result overflows int64_t.
  • Add unit and FuzzTest regression tests covering near-INT64_MAX delays, negative input delays, and large clock periods with non-zero clock margin.

@copybara-service copybara-service Bot changed the title Avoid signed integer overflow in scheduling delay and clock calculations. Reject negative scheduling options and integer overflow in delay and clock calculations. Nov 12, 2026
@copybara-service
copybara-service Bot force-pushed the test_1019401266 branch 2 times, most recently from 6e0a674 to 0afe7d7 Compare November 13, 2026 06:08
…clock calculations.

When `SchedulingOptions` has negative or extreme `int64_t` values (for example from fuzzing `NoFdoSchedulingOptionsFlagsDomain`), negative delays or signed integer overflow when adding path delays, `additional_input_delay_ps`, `additional_output_delay_ps`, `clock_period_ps`, or computing `clock_margin_percent` / `period_relaxation_percent` can cause UB or invalid schedules.

- Reject negative delay/margin/relaxation/throughput options and non-positive `clock_period_ps` / `pipeline_stages` with `absl::InvalidArgumentError` in `OptionsFromFlagProto` (`xls/scheduling/scheduling_options.cc`) and `RunPipelineSchedule` (`xls/scheduling/run_pipeline_schedule.cc`).
- Detect `int64_t` overflow via `SaturatingAdd(...).did_overflow` (and negative node delays) and return `absl::InvalidArgumentError` instead of saturating in `SDCScheduler`, `ScheduleBounds`, `PipelineSchedule::VerifyTiming`, and `RunPipelineSchedule`.
- Update `DecoratingDelayEstimator` (`xls/estimators/delay_model/delay_estimator.h`) to accept `absl::AnyInvocable<absl::StatusOr<int64_t>(Node*, int64_t) const>` so `io_delay_added` in `RunPipelineSchedule` can return `absl::InvalidArgumentError` on negative delays or `int64_t` overflow.
- Use `absl::int128` for intermediate products when applying `clock_margin_percent` and `period_relaxation_percent` in `RunPipelineSchedule`, returning `absl::InvalidArgumentError` if the result overflows `int64_t`.
- Add unit and FuzzTest regression tests covering near-`INT64_MAX` delays, negative input delays, and large clock periods with non-zero clock margin.

PiperOrigin-RevId: 1019401266

This branch has not been deployed

No deployments
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.

1 participant

0