Deadline calculation in ibqReadTimeout and obqWriteTimeout Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
greb
Posts: 10
Joined: Tue Apr 05, 2016 12:50 pm
Has thanked: 2 times
Been thanked: 3 times

Deadline calculation in ibqReadTimeout and obqWriteTimeout  Topic is solved

Postby greb » Thu Jul 12, 2018 9:09 am

Hi,

Under certain circumstances ibqReadTimeout fails when called with a TIME_INFINITE interval.

On line 368 in hal_buffers.c the deadline gets calculated regardless if it's used later. If the size of systime_t and interval_t are different this triggers a chDbgCheck in chTimeAddX.

Recommendation: Only calculate deadline if interval isn't TIME_INFINITE or TIME_IMMEDIATE. The function obqWriteTimeout also has this problem.

Question: chTimeAddX could be a potential source of integer overflows if debug checks are disabled. How should we proceed if we want to add an interval that is larger then the max of systime_t ?

Best regards,
greb

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Deadline calculation in ibqReadTimeout and obqWriteTimeout

Postby Giovanni » Thu Jul 12, 2018 10:52 am

Hi,

Using deadlines you cannot have intervals larger than systime_t, the only solution would be to remove deadlines and have plain timeouts (which would also fix the first problem), we already did this for queues.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Deadline calculation in ibqReadTimeout and obqWriteTimeout

Postby Giovanni » Sun Jul 15, 2018 8:52 am

Hi,

Fixed as bug #963.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 10 guests