Skip to content

audit: Log modifying adjtimex(2) calls

Ondrej Mosnacek linux-audit lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 29 repliesIn review
  2. v4 RFC2 patches 8 repliesSuperseded
  3. v3 RFC3 patches 10 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v2 RFC0 of 5 patches0 repliesSuperseded

Changes in v5 from the cover letter

- Dropped logging of some less important changes and update commit messages
- No longer mark the patchset as RFC

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2audit: Add functions to log time adjustmentsinclude/linux/audit.h include/uapi/linux/audit.h kernel/auditsc.c+38 -022 replies
2/2timekeeping/ntp: Audit clock/NTP params adjustmentskernel/time/ntp.c kernel/time/timekeeping.c+33 -87 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH ghak10 v5 0/2] audit: Log modifying adjtimex(2) calls

This patchset implements more detailed auditing of the adjtimex(2) syscall in order to make it possible to:
a) distinguish modifying vs. read-only calls in the audit log
b) reconstruct from the audit log what changes were made and how they have influenced the system clock

The main motivation is to be able to detect an adversary that tries to confuse the audit timestamps by changing system time via adjtimex(2), but at the same time avoid flooding the audit log with records of benign read-only adjtimex(2) calls.

The current version of the patchset logs the following changes:
- direct injection of timekeeping offset
- adjustment of timekeeping's TAI offset
- NTP value adjustments:
- time_offset
- time_freq
- time_status
- time_adjust
- tick_usec

Changes to the following NTP values are not logged, as they are not important for security:
- time_maxerror
- time_esterror
- time_constant

Audit kernel GitHub issue: https://github.com/linux-audit/audit-kernel/issues/10

Changes in v5:
- Dropped logging of some less important changes and update commit messages
- No longer mark the patchset as RFC

v4: https://www.redhat.com/archives/linux-audit/2018-August/msg00023.html
Changes in v4:
- Squashed first two patches into one
- Renamed ADJNTPVAL's "type" field to "op" to align with audit record conventions
- Minor commit message editing
- Cc timekeeping/NTP people for feedback

v3: https://www.redhat.com/archives/linux-audit/2018-July/msg00001.html
Changes in v3:
- Switched to separate records for each variable
- Both old and new value is now reported for each change
- Injecting offset is reported via a separate record (since this offset consists of two values and is added directly to the clock, i.e. it doesn't make sense to log old and new value)
- Added example records produced by chronyd -q (see the commit message of the last patch)

v2: https://www.redhat.com/archives/linux-audit/2018-June/msg00114.html
Changes in v2:
- The audit_adjtime() function has been modified to only log those fields that contain values that are actually used, resulting in more compact records.
- The audit_adjtime() call has been moved to do_adjtimex() in timekeeping.c
- Added an additional patch (for review) that simplifies the detection if the syscall is read-only.

v1: https://www.redhat.com/archives/linux-audit/2018-June/msg00095.html

Ondrej Mosnacek (2):
audit: Add functions to log time adjustments timekeeping/ntp: Audit clock/NTP params adjustments

 include/linux/audit.h      | 21 +++++++++++++++++++++
 include/uapi/linux/audit.h |  2 ++
 kernel/auditsc.c           | 15 +++++++++++++++
 kernel/time/ntp.c          | 38 ++++++++++++++++++++++++++++++--------
 kernel/time/timekeeping.c  |  3 +++
 5 files changed, 71 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1