Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp837857ybi; Fri, 24 May 2019 12:17:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0NFKfDS+9G16GHhrQLsLzo9W7QZmobNEIyDyz9us0Pgz2dX7Bsv/JzAAumO/NeNcWZ+gS X-Received: by 2002:a62:38d8:: with SMTP id f207mr54831454pfa.131.1558725427305; Fri, 24 May 2019 12:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558725427; cv=none; d=google.com; s=arc-20160816; b=KHG8rxAM3y9Ao0pMYhdqQlJgXHz/EOZ01peyOWA3+SmyhFDB4azeWV3FYTNmPRBCTB Ss8cpUQ0gIrXyaDf8a4E3SiaY8fdcBMmG18eIEMBrGEcdFqks9F/u+ga0dx2pPmfKaia 4VaYgza71u0LjSggs9SljrVtQjbgqKNWEM8+BjLftccUYVzS76Wc3zbQmAoXLbHf6WlV zmI9VKz9zNgSKvkknpexhxfFXiATPK3L6hHqmGvcWnk68L9ICNdEy4r6LPA4HJBfypU9 EzQznWjHbpN46+/Zt9r+9IilG4rYgt+ARAzPl1ltEL7UvquMYwff3qkM56SxE4RHc0ar 1Tlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=e/jxQWXcyAvuh3T0JTB5BpoGRUl6ApcptVVin5u36qk=; b=sgvV+k6uuayyr59hlzq94ps7c2/vhp9l9kV+ESY12FPdEJAhypPV1jmkC+oqbuu9HL ZckmkAWop1QbQOjVnuClP1KNN0JwGtEZVjmEsLd4hMVFOBEDVcKEOQ2nXdWAip0YveOm 04A8wkOu/o8RTHqiHfjVPC6RDFP5GytTEagCV6ivGiE3ITch5RaDZaKy8QqrujYOkeGp HJANalZuTt68XvWpPEskoMAe7T8LpFd2UwAA3H0fGTu9+CKf1ykDl4HxkspkCFy1PF/f ZA3UnhHX8UUbCKD8Kq+hI2ukMx5dDkI9OFMlmWQ7kifVuOxMpT8GtgRmuKRy1MhBPDnJ 8ohA== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si5306751pgk.431.2019.05.24.12.16.50; Fri, 24 May 2019 12:17:07 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391672AbfEXTPk (ORCPT + 99 others); Fri, 24 May 2019 15:15:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33810 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729597AbfEXTPj (ORCPT ); Fri, 24 May 2019 15:15:39 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4OJCBdu109279 for ; Fri, 24 May 2019 15:15:38 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2spnx59r3t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 24 May 2019 15:15:38 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 May 2019 20:15:36 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 24 May 2019 20:15:33 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4OJFWsn43515912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2019 19:15:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 284ED68129; Fri, 24 May 2019 19:15:32 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42BD16811F; Fri, 24 May 2019 19:15:31 +0000 (GMT) Received: from dhcp-9-31-103-88.watson.ibm.com (unknown [9.31.103.88]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 24 May 2019 19:15:31 +0000 (GMT) Subject: Re: Re: From: Mimi Zohar To: prakhar srivastava Cc: Roberto Sassu , linux-integrity , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Garrett , vgoyal@redhat.com Date: Fri, 24 May 2019 15:15:30 -0400 In-Reply-To: References: <20190521000645.16227-1-prsriva02@gmail.com> <20190521000645.16227-3-prsriva02@gmail.com> <1558710722.3977.68.camel@linux.ibm.com> <1558721385.3977.84.camel@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19052419-0016-0000-0000-0000027F1FBC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19052419-0017-0000-0000-000032DC1DE6 Message-Id: <1558725330.3977.119.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-24_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905240124 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-05-24 at 12:00 -0700, prakhar srivastava wrote: > On Fri, May 24, 2019 at 11:09 AM Mimi Zohar wrote: > > > > > >> As mentioned, the first patch description should include a shell > > > >> command for verifying the digest in the kexec boot command line > > > >> measurement list record against /proc/cmdline. This patch description > > > >> should include a shell command showing how to verify the digest based > > > >> on the new field. Should the new field in the ascii measurement list > > > >> be displayed as a string, not hex? > > > > > > > > We should define a new type. If the type is DATA_FMT_STRING, spaces are > > > > replaced with '_'. > > > > > > Or better. Leave it as hex, otherwise there would be a parsing problem > > > if there are spaces in the data for a field. > > > > After making a few changes, the measurement list contains the > > following kexec-cmdline data: > > > > 10 edc32d1e3a5ba7272280a395b6fb56a5ef7c78c3 ima-buf > > sha256:4f43b7db850e > > 88c49dfeffd4b1eb4f021d78033dfb05b07e45eec8d0b45275 > > kexec-cmdline > > 726f6f > > 743d2f6465762f7364613420726f2072642e6c756b732e757569643d6c756b73 > > 2d6637 > > 3633643737632d653236622d343431642d613734652d62363633636334643832 > > 656120 > > 696d615f706f6c6963793d7463627c61707072616973655f746362 > > > > There's probably a better shell command, but the following works to > > verify the digest locally against the /proc/cmdline: > > > > $ echo -n -e `cat /proc/cmdline | sed 's/^.*root=/root=/'` | sha256sum > > 4f43b7db850e88c49dfeffd4b1eb4f021d78033dfb05b07e45eec8d0b4527f65 - > > > > If we leave the "buf" field as ascii-hex, what would the shell command > > look like when verifying the digest based on the "buf" field? > > > > Mimi > > > To quickly test the sha256 i used the my /proc/cmdline > ro quiet splash vt.handoff=1 ima_policy=tcb ima_appraise=fix > ima_template_fmt=n-ng|d-ng|sig|buf ima_hash=sha256 > > export $VAL= > 726f2071756965742073706c6173682076742e68616e646f66663d3120 > 696d615f706f6c6963793d74636220696d615f61707072616973653d666 > 97820696d615f74656d706c6174655f666d743d6e2d6e677c642d6e677c > 7369677c62756620696d615f686173683d736861323536 > > echo -n -e $VAL | xxd -r -p | sha256sum > 0d0b891bb730120d9593799cba1a7b3febf68f2bb81fb1304b0c963f95f6bc58 - > > I will run it through the code as well, but the shell command should work. Yes, that works. sudo cat /sys/kernel/security/integrity/ima/ascii_runtime_measurements | grep kexec-cmdline | cut -d' ' -f 6 | xxd -r -p | sha256sum Mimi