Opened 15 years ago

Closed 14 years ago

#6061 closed bug (fixed)

[PATCH] Fix OpenFirmware system_time

Reported by: andreasf Owned by: andreasf
Priority: normal Milestone: R1
Component: System/Boot Loader Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #5240
Platform: PowerPC

Description

OpenFirmware-based system_time implementation returned the number of milliseconds since boot multiplied by 1000. On my PowerMac G3 300 MHz this results in values around 1600000 and due to the limited resolution often to identical values on subsequent boots.

Thus system_time becomes unusable as a PRNG seed for TCP client ports since the server would be in the Timed Wait state, resulting in a connection timeout.

Attachments (4)

0001-Fix-some-line-endings-with-dos2unix.pl.patch (11.0 KB ) - added by andreasf 15 years ago.
proposed patch to fix line endings
0002-of_milliseconds-returned-0-in-case-of-failure-so-the.patch (928 bytes ) - added by andreasf 15 years ago.
proposed patch: of_milliseconds would never fail
0003-system_time-Fall-back-to-get-msecs-if-milliseconds-f.patch (2.2 KB ) - added by andreasf 15 years ago.
optional patch: Besides milliseconds there appears to be a get-msecs
0004-system_time-Use-get-time-on-rtc-device.patch (1.5 KB ) - added by andreasf 15 years ago.
proposed patch: Use get-time on rtc device

Download all attachments as: .zip

Change History (10)

by andreasf, 15 years ago

proposed patch to fix line endings

comment:1 by andreasf, 15 years ago

patch: 01

by andreasf, 15 years ago

proposed patch: of_milliseconds would never fail

by andreasf, 15 years ago

optional patch: Besides milliseconds there appears to be a get-msecs

by andreasf, 15 years ago

proposed patch: Use get-time on rtc device

comment:3 by andreasf, 15 years ago

The attached patch series first fixes line endings (feel free to run a tool yourself, there may be more files affected - helps keep patches readable), then fixes the return value of of_milliseconds, optionally makes system_time fall back to get-msecs and as main change uses get-time for system_time, as done later in the kernel real time clock implementation.

comment:4 by andreasf, 15 years ago

Patch 4 withdrawn due to errors later on about missing close method (and with of_close commented out the kernel hanging immediately after load). The preceding patches are not affected and could be reviewed and applied.

in reply to:  4 comment:5 by andreasf, 15 years ago

Sorry for the noise - breakage is no longer reproducible, must've been a side effect of my playings with the frame buffer (e.g., handle vs. package issues).

comment:6 by andreasf, 15 years ago

Owner: changed from axeld to andreasf
Status: newin-progress

Applied a new run of dos2unix.pl in hrev37265, obsoleting patch 0001.

comment:7 by andreasf, 14 years ago

Resolution: fixed
Status: in-progressclosed

Applied patch 0002 in hrev37279 and patch 0004 in hrev38465.

Note: See TracTickets for help on using tickets.