Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4025538imm; Mon, 20 Aug 2018 08:35:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwO/mMnVff30DMsAV3RDOv6Ewp9roAk2jzlba30A4AWfIRK7ZEqO7NccS+EAx5DuCeO3pAo X-Received: by 2002:a17:902:bc4b:: with SMTP id t11-v6mr8603235plz.262.1534779319230; Mon, 20 Aug 2018 08:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534779319; cv=none; d=google.com; s=arc-20160816; b=f/rrqkb9Tdc447AnxWCNmPsq3s+hKVEEZSPF7Dv94yU86MwvTHIFWlTSczFIk1DZoJ b2j0PSAle59aT3wpmC8VXSzoDToNCBfvAzV8ydCUCB1LPvcLOvXdV1Jj3lJa+SHxhGEH pepQSADwjquQArHWoK8NJwt5NqZDqT/RMMVT7EuL9vwg9UlHKbo9H6rRbZiyEoFKYQ5r /aszrqNvp1YFKXzTn5osIQHe7+L/i/q87PTWvUg/52JJj8vq5REPROH0AtznZCX8d3kF rq++2Ff/jl0QQrubJA94wCU+yKMlyR3VJ0T1OmM265anijDK401SSR0Rv3MHYljr7jIz 7PwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=H88l5X8yTzBtZLoB7sts7azrnv3heoIX6SphVeNFiI8=; b=gOxX17lA7fXwsNmh33+nIZRcX10APvZTSm0zgY99nhqzkJEY+8+Xv/5wRDpP30cx7H Tswi9S+B9RHmT+SEHOiNctYUmYheF0grzW22t+Ks3NamDG1Mvsi/sKbaCTUvTdNC01vr fPXyoCZSjQx8QKVM2avc+6yhq6PO68Ddl88O/prTZGtD4h3YFH7/en5wyRSy6s8L/Xgl sPZ8LsecUGdzHPF4wEY4s/e9dSmdFD4cXX99fSNkF1HGBExxcNFjAtBhJ621NvzLBafB QYfuKgQxPVXZm6V8dMPVx/cH03R1rvFqlH14l/b0VzvwChT1FC3wXcrt6YmOOT1hHrmW bpDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a84-v6si10249338pfj.300.2018.08.20.08.35.04; Mon, 20 Aug 2018 08:35:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbeHTSiF (ORCPT + 99 others); Mon, 20 Aug 2018 14:38:05 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55789 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbeHTSiF (ORCPT ); Mon, 20 Aug 2018 14:38:05 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1frm0D-00083Q-QY; Mon, 20 Aug 2018 17:21:57 +0200 Date: Mon, 20 Aug 2018 17:21:57 +0200 (CEST) From: Thomas Gleixner To: Ondrej Mosnacek cc: linux-audit@redhat.com, Paul Moore , Richard Guy Briggs , Steve Grubb , John Stultz , Stephen Boyd , LKML , Miroslav Lichvar Subject: Re: [RFC PATCH ghak10 v4 0/2] audit: Log modifying adjtimex(2) calls In-Reply-To: <20180820123818.27547-1-omosnace@redhat.com> Message-ID: References: <20180820123818.27547-1-omosnace@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Aug 2018, Ondrej Mosnacek wrote: + Miroslav Lichvar > Hi, > > 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. > > @John or other timekeeping/NTP folks: We had a discussion on the audit > ML on which of the internal timekeeping/NTP variables we should actually > log changes for. We are only interested in variables that can (directly > or indirectly) cause noticeable changes to the system clock, but since we > have only limited understanding of the NTP code, we would like to ask > you for advice on which variables are security relevant. > > Right now, the patchset is conservative and logs all changes that can be > done via adjtimex(2): > - direct injection of timekeeping offset (obviously relevant) > - adjustment of timekeeping's TAI offset > - NTP value adjustments: > - time_offset (probably important) > - time_freq (maybe not important?) > - time_status (likely important, can cause leap second injection) > - time_maxerror (maybe not important?) > - time_esterror (maybe not important?) > - time_constant (???) > - time_adjust (sounds important) > - tick_usec (???) > > Could you please give us some hints on the effect of changing these > variables and whether you think that it is important to log their > changes? > > Thanks a lot! > > > GitHub issue: https://github.com/linux-audit/audit-kernel/issues/10 > > Changes in v4: > - Squashed first two patches into one > - Rename 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 | 50 ++++++++++++++++++++++++++++++-------- > kernel/time/timekeeping.c | 3 +++ > 5 files changed, 81 insertions(+), 10 deletions(-) > > -- > 2.17.1 > >