agent: Fix S2K calibration.
AbandonedPublic

Authored by gniibe on Oct 29 2017, 12:52 PM.

Details

Reviewers
gouttegd
Summary
  • agent/protect.c (calibrate_get_time): Use clock_gettime when the

CLOCK_THREAD_PROCESS_ID clock is available. On non-W32 systems,
store time directly as milliseconds instead of clock ticks.
(calibrate_elapsed_time): Fix computation of elapsed time accordingly.

(struct calibrate_time_s): Rename member ticks to ms.

GnuPG-bug-id: 3276
Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>

Test Plan

Run the agent/t-protect test program and check the time needed for the calibration. In particular, check that the program does not remain stuck indefinitely in the calibration loop.

Tested on a Linux-4.11.7 kernel with the VIRT_CPU_ACCOUNTING_GEN option enabled (a configuration known to trigger the reported bug). Also tested on Linux-4.13.2 but the bug does not seem to manifest itself under that kernel, with or without this patch.

Diff Detail

Repository
rG GnuPG
Lint
Lint Skipped
Unit
Unit Tests Skipped
gouttegd created this revision.Oct 29 2017, 12:52 PM
gniibe accepted this revision.Feb 13 2019, 10:52 AM
gniibe added a subscriber: gniibe.

Final fix was rG380bce13d94f: agent: Use clock or clock_gettime for calibration., with clock.
Closing this patch.

This revision is now accepted and ready to land.Feb 13 2019, 10:52 AM
gniibe commandeered this revision.May 16 2019, 9:19 AM
gniibe edited reviewers, added: gouttegd; removed: gniibe.

The change is adopted. To close this patch, I take over.

This revision now requires review to proceed.May 16 2019, 9:19 AM
gniibe abandoned this revision.May 16 2019, 9:20 AM