Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2728369ybt; Tue, 16 Jun 2020 13:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxqIIGVHItAZb15VztUzpN8T+xtZetTt7tiDNDed4b0ntmQ60rolXkzhPxUbsrVpZgD0+4 X-Received: by 2002:a17:906:6457:: with SMTP id l23mr4304869ejn.188.1592339613950; Tue, 16 Jun 2020 13:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592339613; cv=none; d=google.com; s=arc-20160816; b=Cao7AzDNXYUmgLv0OKZTBAOO+wRuEzKZUAJmn16E6WiJwt8yuHi6fmKbQddkYWbsof JGmx+v/C3NoyAFl6m7WzEojRTNGCko8YYd4802Fn7wXu3UEKnxpKkQuw6wbnmvn6j9IR QTh4X2zF1nfF/z6yHZJgvJ9KGecmyKCM/DM4bE/oGAa21ZMbb/BQKY6/1he+SKTzUo0j hCSGFJ2gLKcspMy4wmnxs6FJvVJfi9rBgDVvYAADblKPB1gX8N0Q/p35i7GQ3BvGKQCy i8lpKYzu5R7zv1jFdvu8Z6kPio4ErDhf77SvskyVB0XjFD3f45Ytlf+9EfuCycKDoLLF dGIw== 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:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=PuFuQg6K4e8+oPcKh4HKkSbhQEN3+Z7Dt+MuhnK0tiM=; b=W1Dxa/IVzpvNVIrpvfZUBgNei1i8BgRatxF8nxrWZATVPZQgQFw5axNgf83MCo9Cz7 xgCHKu/kKbHbUYfWuKfi5CkEcGXNOmT0f8KMtL7RTcCTwxh5HN6xc2h9StdlV0w3reeE 6GwNRa2vN81G2UZ6x5Gl73BN03b0Dle6YZA9I9Ph25K5Q6x0RS9bQnrdWRVPilLLQ4Wa pmvTkhh2S+2cGblwOLrZnV25AdC5JQaHYoS92FKT9WF0ufbt5vxRQ9k9EG/NSo07ZWUJ pSxtiVXzWyyx4+LygliSmQ9wJkVXOukfIUxtTAXtiElIAH6ufsjPt8HIwbdAdKGTab4o 7TbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iXnAb/NB"; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si10873321edf.467.2020.06.16.13.33.11; Tue, 16 Jun 2020 13:33:33 -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=@redhat.com header.s=mimecast20190719 header.b="iXnAb/NB"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731765AbgFPU3H (ORCPT + 99 others); Tue, 16 Jun 2020 16:29:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53464 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726428AbgFPU3F (ORCPT ); Tue, 16 Jun 2020 16:29:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592339343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PuFuQg6K4e8+oPcKh4HKkSbhQEN3+Z7Dt+MuhnK0tiM=; b=iXnAb/NBHnqEztj45HDCnciZ/QhUWb51ovSyCOqF9hnqfhBGkZqWhzO6OlDJf4Aw+0i5xn dy37r/vANBDbnzW3wFx5M/SH5cr6kgD2DE6J0P4Eeqtzh6QBHNc7iPwVtA54qSI+09N3QX bmQ/RVJQchbw0RNtZpmIQ1WtG2XIZAM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-g5CUkErUN0yKgA33gmgSYw-1; Tue, 16 Jun 2020 16:28:59 -0400 X-MC-Unique: g5CUkErUN0yKgA33gmgSYw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1AF58AB398; Tue, 16 Jun 2020 20:28:52 +0000 (UTC) Received: from x2.localnet (ovpn-113-201.phx2.redhat.com [10.3.113.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06D8D6C1A0; Tue, 16 Jun 2020 20:28:51 +0000 (UTC) From: Steve Grubb To: Mimi Zohar Cc: Lakshmi Ramasubramanian , Paul Moore , rgb@redhat.com, linux-integrity@vger.kernel.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] integrity: Add errno field in audit message Date: Tue, 16 Jun 2020 16:28:47 -0400 Message-ID: <2644117.Ritcz3IfYv@x2> Organization: Red Hat In-Reply-To: <1592337220.11061.239.camel@linux.ibm.com> References: <20200611000400.3771-1-nramas@linux.microsoft.com> <1717101.NiBDiG0Zly@x2> <1592337220.11061.239.camel@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, June 16, 2020 3:53:40 PM EDT Mimi Zohar wrote: > On Tue, 2020-06-16 at 11:55 -0400, Steve Grubb wrote: > > On Tuesday, June 16, 2020 11:43:31 AM EDT Lakshmi Ramasubramanian wrote: > > > On 6/16/20 8:29 AM, Steve Grubb wrote: > > > >>>>> The idea is a good idea, but you're assuming that "result" is > > > >>>>> always errno. That was probably true originally, but isn't now. > > > >>>>> For example, ima_appraise_measurement() calls xattr_verify(), > > > >>>>> which compares the security.ima hash with the calculated file > > > >>>>> hash. On failure, it returns the result of memcmp(). Each and > > > >>>>> every code path will need to be checked. > > > >>>> > > > >>>> Good catch Mimi. > > > >>>> > > > >>>> Instead of "errno" should we just use "result" and log the value > > > >>>> given in the result parameter? > > > >>> > > > >>> That would likely collide with another field of the same name which > > > >>> is the operation's results. If it really is errno, the name is fine. > > > >>> It's generic enough that it can be reused on other events if that > > > >>> mattered. > > > >> > > > >> Steve, what is the historical reason why we have both "res" and > > > >> "result" for indicating a boolean success/fail? I'm just curious > > > >> how we ended up this way, and who may still be using "result". > > > > > > > > I think its pam and some other user space things did this. But > > > > because of mixed machines in datacenters supporting multiple versions > > > > of OS, we have to leave result alone. It has to be 0,1 or success/ > > > > fail. We cannot use it for errno. > > > > > > As Mimi had pointed out, since the value passed in result parameter is > > > not always an error code, "errno" is not an appropriate name. > > > > > > Can we add a new field, say, "op_result" to report the result of the > > > specified operation? > > > > Sure. But since it is errno sometimes, how would we know when to > > translate it? > > Perhaps the solution is not to imply "res" is "errno", but pass it as > a separate "errno" field. That's what is done on syscalls. There is success and exit where they both have different meaning sometimes but otherwise they agree. > Then only include "errno" in the audit message when it isn't zero. This > assumes that some audit messages for the same audit number include errno, > while others do not. We normally do not like to have fields that swing in and out because then its hard to know exactly what's in the event. When an event has different fields under special conditions, then we just say call it a new event. Split it into 2 or 3 instead forcing it all into 1. And we also do not like fields that change meaning. Because then intepretation becomes hard. Or other people wishing to record the same info in another event have to follow the same pattern. So, if you really need this field, the give some name like err_code or errno or anything not taken. And just fill it out every time. Its OK to be 0. If this only happens under some special operation, then make it a new event and fill it out only for that operation/event. Best Regards, -Steve > With this solution, the existing integrity_audit_msg() could become a > wrapper for the new function. > > Mimi