Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4514711pxv; Tue, 20 Jul 2021 05:41:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVIuNhxbmvPSJ2zcurwjBbT4RLJEsSxofYfak4V8lZkONuncPWRAxVYBUWXIrjjs1XTZ8c X-Received: by 2002:a17:906:b794:: with SMTP id dt20mr32522976ejb.431.1626784861792; Tue, 20 Jul 2021 05:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626784861; cv=none; d=google.com; s=arc-20160816; b=YxS1e/CzW0ml9S0NpCoRvJ0tzi7LCSK2THe6ULH+rm0AODTrdyQfc3fvBg6uOVFM/n cNULGJgox7XeVSp03PMy+HIP+l1JVBm+ueAZ72ojukFiRERXvFAQQJiqLdlWyo1UMc7V ajrzKZszGmpCUAnUjHT+vh4aGmtZqQZBk07TxY2fi0GCqY5oJ6oViwlaWrjBC3XKu/gx Ypv9BT/ppfuYY5rSwjLd3DHCFJaYNa6Hlcvk0jLhvgHLyja/aXW0e/ShJm+IRGLUVLUD ckaNCs3IByFcu8TH1axFrBNoAiUaj2RFrXYUw7LyFU31kJHaNePb4n9tG8rFmGXOnHRn ikHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=PqUFZxU7fPHhwub6Fqd1e6CNwmGABQxIviY83mWg1Xs=; b=erHYaPLHwzNOQlbkDjS2Mj/vXm18zP63RLsXBI59FFnvj3FAlZ9S1v6j5vQCKPV5QS uP8C+a/7TAzXZe7Wi8+WPGVWV7AxLojMt8zu/5SXsYcCRVjsZfWUidOlgOmbdeTdd/1Z dFTs5fS3JRvHstWz5XEx423WWBfegSR7y0qI4If5tM2b536jdsE8od9TQWf9PL6Da8b3 i6TOQ5S1IYxZxf6i+DuKc01CbJ05Ej377+xpG5GyziAXIxCE+BP2bzOApT3FaQejSApG FzvjKHf7mdECa8RcXVu3DSq1iCYNuIN7eRujQQ+f7QfGyegJU2ABSWqX8pgpI9XjqIzk A4Sg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd15si22131436ejc.47.2021.07.20.05.40.38; Tue, 20 Jul 2021 05:41:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbhGTL6K convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Jul 2021 07:58:10 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3437 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhGTL6I (ORCPT ); Tue, 20 Jul 2021 07:58:08 -0400 Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GTdJN0CSYz6J7CM; Tue, 20 Jul 2021 20:27:16 +0800 (CST) Received: from fraeml714-chm.china.huawei.com (10.206.15.33) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 20 Jul 2021 14:38:43 +0200 Received: from fraeml714-chm.china.huawei.com ([10.206.15.33]) by fraeml714-chm.china.huawei.com ([10.206.15.33]) with mapi id 15.01.2176.012; Tue, 20 Jul 2021 14:38:43 +0200 From: Roberto Sassu To: Mimi Zohar , "paul@paul-moore.com" CC: "stephen.smalley.work@gmail.com" , "prsriva02@gmail.com" , "tusharsu@linux.microsoft.com" , "nramas@linux.microsoft.com" , "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "selinux@vger.kernel.org" Subject: RE: [PATCH v3 2/3] ima: Return int in the functions to measure a buffer Thread-Topic: [PATCH v3 2/3] ima: Return int in the functions to measure a buffer Thread-Index: AQHXcX2Ei9vr21t1tkWOaZ1ebtrZQatKtK2AgAEtQtA= Date: Tue, 20 Jul 2021 12:38:43 +0000 Message-ID: References: <20210705090922.3321178-1-roberto.sassu@huawei.com> <20210705090922.3321178-3-roberto.sassu@huawei.com> <2f4920dbdb16156e1af5cf78f592a5cf07ec3176.camel@linux.ibm.com> In-Reply-To: <2f4920dbdb16156e1af5cf78f592a5cf07ec3176.camel@linux.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.221.98.153] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > Sent: Monday, July 19, 2021 10:28 PM > Hi Roberto, > > On Mon, 2021-07-05 at 11:09 +0200, Roberto Sassu wrote: > > ima_measure_critical_data() and process_buffer_measurement() currently > > don't return a result. A caller wouldn't be able to know whether those > > functions were executed successfully. > > Missing is an explanation as to why these functions aren't currently > returning a result. The LSM/IMA hooks only return a negative result > for failure to appraise a file's integrity, not measure a file. Only > failure to appraise a file's integrity results in preventing the file > from being read/executed/mmaped. Other failures are only audited. Hi Mimi ok, will add it. > > This patch modifies the return type from void to int, and returns 0 if the > > buffer has been successfully measured, a negative value otherwise. > > Needed here is an explanation as to why ima_measure_critical_data() is > special. We don't want to unnecessarily calculate the digest twice. > > Also, this patch does not modify the behavior of existing callers by > > processing the returned value. For those, the return value is ignored. > > I agree that the existing behavior shouldn't change, but will this > result in the bots complaining? If I remember correctly, I didn't get any error even with W=1. Thanks Roberto HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Li Peng, Li Jian, Shi Yanli > thanks, > > Mimi