Received: by 10.192.165.148 with SMTP id m20csp793572imm; Wed, 2 May 2018 08:54:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxhYu3IoqHtnbZbRt8LiYXBXTtxAjY0Csiz5VH696O2y3Kl0F4WpyaP7AWz8SikDjCwcU5 X-Received: by 2002:a17:902:bc48:: with SMTP id t8-v6mr20628509plz.133.1525276483462; Wed, 02 May 2018 08:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525276483; cv=none; d=google.com; s=arc-20160816; b=aNjDx2b5absgAWN71KpJPeFqu2x6DKpN5IRaPUOm5YFrlz9W/9LJ0HEI+13dyD08Bk m6PLIMs4QacVOoXonkOteQXLusMk6za5MMGkZ98HznV+jTTVFRNUoRsjzDHdPcHv61yD pLjMPlex/gZGFGgDCmsHKeorcRa4tjWaNuZrVpeqhQWDWrz+IwtZNUMLC4LG4ud1MKk0 GE+NPaNgDMEjuRjfYqQA8E9vmy+C9E8mYXNYQfd4jZoX2rzoBCUtHOSpg345PjUgjbV/ hW1rFfokBCMfN+FFP+4nrUxbLJXS/HGfzDxjU+fk2pFlfydTzWDO/XKl5bI8/9oxMGM9 Gy7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Mrf97vwaEhXWVXzGkpPHO4Ic1NNylZeZSFdwqahA+j0=; b=w/GcxZD2rNhF+VYQiBCks2BIFoUqOMTYDEB1whGZFDzfQyoko2tvr0V5HuLumxNAoS QAbWg9qgMOk2XJNk65gKFTN6O2ezNuaNan1nRYt71p6mqlxv/6mZh2CFHVyRrsVQ2P9D vmDz9sv9Xzps4IZq1mWQD09EAs66/1JxRli7hYMxBQsF4hKCnY3mHTuJWtupPdK2UnR+ Y2vMg5MSTkIlg2XnZlNWggjB8CTnAfdJyFeB0bZh29L/r72oKbYr+8A0xg58qz7hxqMB WpoUwji3rJnhWXgKTI7HXBgCSiGqXK1/Y6FMysSJunK8QJnHucEuGG4ArOHQmHcB69TZ VSUQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b78si11676480pfj.2.2018.05.02.08.54.29; Wed, 02 May 2018 08:54:43 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751742AbeEBPyJ (ORCPT + 99 others); Wed, 2 May 2018 11:54:09 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54836 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbeEBPyG (ORCPT ); Wed, 2 May 2018 11:54:06 -0400 Received: from 2.general.tyhicks.us.vpn ([10.172.64.53] helo=sec.l.tihix.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fDu4y-0007uo-Ld; Wed, 02 May 2018 15:54:04 +0000 From: Tyler Hicks To: linux-kernel@vger.kernel.org Cc: Kees Cook , Andy Lutomirski , Will Drewry , Paul Moore , Eric Paris , Steve Grubb , Jonathan Corbet , linux-audit@redhat.com, linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v2 0/4] Better integrate seccomp logging and auditing Date: Wed, 2 May 2018 15:53:16 +0000 Message-Id: <1525276400-7161-1-git-send-email-tyhicks@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Seccomp received improved logging controls in v4.14. Applications can opt into logging of "handled" actions (SECCOMP_RET_TRAP, SECCOMP_RET_TRACE, SECCOMP_RET_ERRNO) using the SECCOMP_FILTER_FLAG_LOG bit when loading filters. They can also debug filter matching with the new SECCOMP_RET_LOG action. Administrators can prevent specific actions from being logged using the kernel.seccomp.actions_logged sysctl. However, one corner case intentionally wasn't addressed in those v4.14 changes. When a process is being inspected by the audit subsystem, seccomp's decision making for logging ignores the new controls and unconditionally logs every action taken except for SECCOMP_RET_ALLOW. This isn't particularly useful since many existing applications don't intend to log handled actions due to them occurring very frequently. This amount of logging fills the audit logs without providing many benefits now that application authors have fine grained controls at their disposal. This patch set aligns the seccomp logging behavior for both audited and non-audited processes. It also emits an audit record, if auditing is enabled, when the kernel.seccomp.actions_logged sysctl is written to so that there's a paper trail when entire actions are quieted. Changes since v1: * Patch 1 - No changes * Patch 2 - New patch, allowing for a configurable separator between action names * Patch 3 - The value of the actions field in the audit record now uses a comma instead of a space - The value of the actions field in the audit record is no longer enclosed in quotes - audit_log_start() is called with the current processes' audit_context in audit_seccomp_actions_logged() - audit_seccomp_actions_logged() no longer records the pid, uid, auid, tty, ses, task context, comm, or executable path - The new and old value of seccomp_actions_logged is recorded in the AUDIT_CONFIG_CHANGE record - The value of the "res" field in the CONFIG_CHANGE audit record is corrected (1 indicates success, 0 failure) - Updated patch 3's commit message to reflect the updated audit record format in the examples * Patch 4 - A function comment for audit_seccomp() was added to explain, among other things, that event filtering is performed in seccomp_log() Tyler