Skip to content

time_slave accepts a preciseOriginTimestamp that is out of range #344

Open

Description

@mattday-etas

Description

Summary: A Follow_Up with seconds > 2^32 - 1 (48 bit seconds field) or nanoseconds > 999 999 999 synchronizes the vehicle time.

Description: TimestampToTmv() (score/time_slave/src/gptp/details/ptp_types.h) only checks that the value fits into int64 nanoseconds. It accepts seconds beyond the 2^32 - 1 range of vehicle time and any 32-bit nanoseconds value, and returns 0 on an overflow, which the caller uses as the time 0. No message is dropped for an out-of-range timestamp.

Requirement: feat_req__time__veh_drop_out_of_range.

Found during development of an integration test, test_out_of_range_origin_timestamp_is_discarded (seconds 2^32, 2^48 - 1; nanoseconds 10^9, 2^32 - 1): the slave reports synchronized after each of them. The boundary value (2^32 - 1 s, 999 999 999 ns) is accepted correctly (test_origin_timestamp_at_the_range_limit_is_used).

Proposal: Reject the Follow_Up (in the parser or in SyncStateMachine::OnFollowUp) if the seconds exceed 2^32 - 1 or the nanoseconds exceed 999 999 999, and do the same for the timestamps of the Pdelay messages. An overflow must not become the time 0.

Acceptance criteria

  • Unit tests for each limit (inclusive) and each excess, for Follow_Up and the Pdelay messages.

Impact: One malformed frame from any node on the link can set the time slave to a nonsensical time (related: #311).

Problem notifications

No response

Analysis results

No response

Solution

No response

Error Occurrence Rate

None

How to reproduce

No response

Supporting Information

No response

Classification

Major

First Affected Release

not released (main)

Last Affected Release

not released (main)

Expected Fixed Release

before release (main)

Category

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions