Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp776508ybt; Wed, 17 Jun 2020 13:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK8RkX69VkL3dDnzQceOF/4i0BM+EJFJiNjQZJPb9lCaG6+KLIeWGJbdvuxIEaz9Y7buyR X-Received: by 2002:a17:906:2e1a:: with SMTP id n26mr875382eji.425.1592426827056; Wed, 17 Jun 2020 13:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592426827; cv=none; d=google.com; s=arc-20160816; b=LsKKZ8EcLDm67620tBRtgcA8d1XxCUYbCJel52PY8gZWnwA2PTsW+A4GoumHZwcBrs Rrnk/9QUNA0pZNXi3+eRkZx5l5XbZUg7zZOVaHNZIemUN1JKvs9zPxagXGZUitFNVM5B lCVTCxhcnF6YrLpbgzPgPRbLTZJPApz9DF6YTOHdDVO1nXJkcrm+ujQjV9rA2AqOUQXP 3JSeKG85SmfggAq8yLEOeA+m5uxAIlH9rANG9ytBIttIzhTrQrShzD4JaTw3buSn8Bod VAAe7fD8vhFyKt8PZYUqRD97EITXT57W6GCaWVmnVgYY+60gItoIZozV1M2ZniVPJUfq WnBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=sd/3a2ymDFt3eq7MlVb5ASMA/r4IGCb1y6MMEDUE1Vk=; b=0a5iCfhFsgLA8qTxJhQnUs78Z5AxqbWxepn5K+PkBKEFA2e5xrmBZfa+cMJWVZhJxm Li9+/3+ZZ+p3Iq+Mb1ZkhKUwmjMw9+KxUrKk2SHBt+kRoDZmFe1ZrZjb97fuBp/Liq9W MviOaN6ctlU+5nFFzxRBqRa8yTbPCwkYtxb68824lBx+nvfMATOPH3GIS6LUm+zzgHmE XT8HTJuOblOS/j1sIrrGBcRj5N4RKoCHXGVUzhlJSZT7ySGdtkJvLv6tN4ODNMd5Jf1K uJDAItAqfuSsibiOTpxdrxF9uKSkq/VzanTmsCSattFNvIiGAeXSIq5qSSayhLdL13gT 8r2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CJqbx0vs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si627778edt.501.2020.06.17.13.46.44; Wed, 17 Jun 2020 13:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CJqbx0vs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbgFQUom (ORCPT + 99 others); Wed, 17 Jun 2020 16:44:42 -0400 Received: from linux.microsoft.com ([13.77.154.182]:55578 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbgFQUom (ORCPT ); Wed, 17 Jun 2020 16:44:42 -0400 Received: from localhost.localdomain (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id B038B20B711C; Wed, 17 Jun 2020 13:44:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B038B20B711C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1592426681; bh=sd/3a2ymDFt3eq7MlVb5ASMA/r4IGCb1y6MMEDUE1Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CJqbx0vsRC0+FJXa8A6paq6Cf2UfPWNLuf5ceC5mQx6Bu+X6o2cryjI/0jhPbWr7n BUW6dYx4Ykbi9JY252skHMw1TyxCPsZcX9B3NMFmEBl4NPapTa0zlvfEjVIFWFt9D1 uBxCLj2zMq/ti0idqGfzqF8qqnB+ACrYJeZ6P0GI= From: Lakshmi Ramasubramanian To: zohar@linux.ibm.com, bauerman@linux.ibm.com, nayna@linux.ibm.com, sgrubb@redhat.com, paul@paul-moore.com Cc: rgb@redhat.com, linux-integrity@vger.kernel.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] integrity: Add errno field in audit message Date: Wed, 17 Jun 2020 13:44:36 -0700 Message-Id: <20200617204436.2226-2-nramas@linux.microsoft.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200617204436.2226-1-nramas@linux.microsoft.com> References: <20200617204436.2226-1-nramas@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Error code is not included in the audit messages logged by the integrity subsystem. Add "errno" field in the audit messages logged by the integrity subsystem and set the value to the error code passed to integrity_audit_msg() in the "result" parameter. Sample audit messages: [ 6.284329] audit: type=1804 audit(1591756723.627:2): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel op=add_boot_aggregate cause=alloc_entry comm="swapper/0" name="boot_aggregate" res=0 errno=-12 [ 8.085456] audit: type=1802 audit(1592005947.297:9): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 op=policy_update cause=completed comm="systemd" res=1 errno=0 Signed-off-by: Lakshmi Ramasubramanian Suggested-by: Steve Grubb --- security/integrity/integrity_audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c index 5109173839cc..a265024f82f3 100644 --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c @@ -53,6 +53,6 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode, audit_log_untrustedstring(ab, inode->i_sb->s_id); audit_log_format(ab, " ino=%lu", inode->i_ino); } - audit_log_format(ab, " res=%d", !result); + audit_log_format(ab, " res=%d errno=%d", !result, result); audit_log_end(ab); } -- 2.27.0