From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A7A2C04AB4 for ; Tue, 14 May 2019 05:06:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D9F5E208C3 for ; Tue, 14 May 2019 05:06:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XTnawXYq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbfENFG4 (ORCPT ); Tue, 14 May 2019 01:06:56 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39621 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbfENFG4 (ORCPT ); Tue, 14 May 2019 01:06:56 -0400 Received: by mail-pg1-f196.google.com with SMTP id w22so7957825pgi.6; Mon, 13 May 2019 22:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q7ivzidNqiF6L5Pdt29c2H0Kj0g0EzNa6q9k46tNNOA=; b=XTnawXYqf3R9HsqS96E5qSl06en1GGyJWROir0uXJ4H3z/SYsSv0byyYFtn97lRKqs qQYfpVXf3tM7x/Kivn0rIX1mNhYKE+8imiCpmMVNw5iU5VVgEywypIlUlL2Mkt/pD+8F NUHgoobnCSE3qLigkRuIUg4NF6UktCoJSU8XNtI8V/e6fa1cMtEqnVx3+rC8o7HI2mDd O1NmT2yytRMubHtdZk1HtBBV25qlF1KO4xhoIosFCwIg51FS2JDCP4T7szBFsmoh14mZ mw8+fMsNI2CDyMfIc66Ei1NyrpTK/sfcRk3SUTcuYbx2Pz6QIOkGL8n54CuRu7V+zdni 2oEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q7ivzidNqiF6L5Pdt29c2H0Kj0g0EzNa6q9k46tNNOA=; b=VVw1lYZmEHiAKuZG5MYCLxjZdnPHUmB/zhCBvyeiIa2WOz1jHRaOQ0mIIS8Qn6ktzu 51xY6K9ZVXvL27xNnbmUXHfLtPXbO88icegkF7B7i9RGFeor82K7IR1fWVXDYtwCEdyP 2cpINagHxyZITmUUOLtzO+XuBReL1669De59E1kC894lFtby5TvgK3n2MxqXeL5peJnm umP7Hzgtb1xlbojFgayE2YwzcGH75phaTcmmft1oC7DWsfaZdEHT0Ljd4Mr0zrNB0pGb QqfGQf2hSoxkI5u2Zi28ozXR3Z8NMwOKM0MVbJ83x53UobU74LYqJKGD7V9f+q334tiq Q4lg== X-Gm-Message-State: APjAAAXZd8Zffqu72vIduI7QFQFHF0jppBUwmkuW1y6PtcrbLEiw4R+q Yu2XPX9G4Lo7JVNTPLI7Jm6sRD1jTQfTKNFv2MM= X-Google-Smtp-Source: APXvYqylm3Vo+xJz4QY3Vv3T0tWftZToA2Edue5y3F4dBxuubEGEUZN6SgAVhnE7T2minpfzzHISkVgBpJKYNY+xIWs= X-Received: by 2002:a62:ed1a:: with SMTP id u26mr31636146pfh.229.1557810415272; Mon, 13 May 2019 22:06:55 -0700 (PDT) MIME-Version: 1.0 References: <20190510223744.10154-1-prsriva02@gmail.com> <20190510223744.10154-3-prsriva02@gmail.com> <45344b2f-d9ea-f7df-e45f-18037e2ba5ca@huawei.com> In-Reply-To: <45344b2f-d9ea-f7df-e45f-18037e2ba5ca@huawei.com> From: prakhar srivastava Date: Mon, 13 May 2019 22:07:08 -0700 Message-ID: Subject: Re: [PATCH 2/3 v5] add a new template field buf to contain the buffer To: Roberto Sassu Cc: linux-integrity@vger.kernel.org, inux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Mimi Zohar , ebiederm@xmission.com, vgoyal@redhat.com, Prakhar Srivastava Content-Type: text/plain; charset="UTF-8" Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Mon, May 13, 2019 at 6:48 AM Roberto Sassu wrote: > > On 5/11/2019 12:37 AM, Prakhar Srivastava wrote: > > From: Prakhar Srivastava > > > > The buffer(cmdline args) added to the ima log cannot be attested > > without having the actual buffer. Thus to make the measured buffer > > available to store/read a new ima template (buf) is added. > > Hi Prakhar > > please fix the typos. More comments below. > > > > + buffer_event_data->type = IMA_XATTR_BUFFER; > > + buffer_event_data->buf_length = size; > > + memcpy(buffer_event_data->buf, buf, size); > > + > > + event_data.xattr_value = (struct evm_ima_xattr_data *)buffer_event_data; > > + event_data.xattr_len = alloc_length; > > I would prefer that you introduce two new fields in the ima_event_data > structure. You can initialize them directly with the parameters of > process_buffer_measurement(). I will make the edits, this will definitely save the kzalloc in this code path. > > ima_write_template_field_data() will make > a copy. > Since event_data->type is used to distinguish what the template field should contain. Removing the type and subsequent check in the template_init, buf template fmt will result in the whole event_Data structure being added to the log, which is not the expected output. For buffer entries, the buf templet fmt will contains the buffer itself. > > > + .field_show = ima_show_template_buf}, > > Please update Documentation/security/IMA-templates.rst Will update the documentation. Thanks, Prakhar Srivastava > > Thanks > > Roberto