Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp715231ybz; Wed, 15 Apr 2020 17:21:15 -0700 (PDT) X-Google-Smtp-Source: APiQypIo5W2y4sw71I31cPeUUBP9bwEm2TLQfljZnetznc3QATL0tKpxb0Cmj7Nxs3ZdtHki2hY9 X-Received: by 2002:a17:906:2296:: with SMTP id p22mr7282173eja.269.1586996475595; Wed, 15 Apr 2020 17:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996475; cv=none; d=google.com; s=arc-20160816; b=kOXdpVlw8YHPt+pCkkT+KMm5MEyjn+SSAKT9i3NGGDpuJcxMijQS8rR5Yo2zV81FmB hKpmF/MWsnZ9Rr3M4GvO4UnWRkvHZpzKdtHrZl5TnqUkeZ4y5N76CRixf5W4palhv8X/ cuN418lBemnICtQI0rFtCbm/c7JzFfVRpiZGY8/CCN4YaBjDsMGec2FwVmg8f+BaN2sJ jYYAXn0o+Gc7wxNrOkxO5CbAv9sni9jP2JbNfNo2fauDzAKoA7IfDDmg2/hgtpU0ROKd qqgRPHnbvPCfJQaLR8ed3ta8/OjknkDgQEWEMTPIBlraHrid4GqSJAl85Vyut/o3fizk XMkQ== 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=FaexFtinUGsm8rBXc8VWllMcor6Su8B/guvXMx58Nts=; b=Zjcke+dy5IF/7RgnhDT6Ot7tns+ZPALzssJJwGdkfYcztMxfhYTJsSAAf+UW/ewZrt mYNwyPLgd46y5BFXuictH1ftABpRKY7MK+dE9jUpqi/ik9srzxUld9ND4GcyuX3U2m3b w11AMvPJw6SToEMxQ01KoHUpoHVq9v1rflIGM//9V+Dm95fUwi015uwGj1dDhvRLGBpJ zymC+oz105NXgdv9af8/08Y0Um1a71VwePeNlJEN5sPhyUtqANlw+IpCUNO4mbi/zPU6 /RdulM/9dF4NwoA9etKd2z8xW+h4GvvreYKQLLL6LGuRhzNfoEPWu6umpLW5O1MBbgVj P5Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=hWUxUbYc; 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 24si11131059ejv.109.2020.04.15.17.20.52; Wed, 15 Apr 2020 17:21:15 -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=hWUxUbYc; 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 S1415953AbgDOQ15 (ORCPT + 99 others); Wed, 15 Apr 2020 12:27:57 -0400 Received: from linux.microsoft.com ([13.77.154.182]:49188 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1415792AbgDOQ0C (ORCPT ); Wed, 15 Apr 2020 12:26:02 -0400 Received: from dede-linux.corp.microsoft.com (unknown [131.107.147.242]) by linux.microsoft.com (Postfix) with ESMTPSA id 8C3B120BC5ED; Wed, 15 Apr 2020 09:25:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C3B120BC5ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1586967957; bh=FaexFtinUGsm8rBXc8VWllMcor6Su8B/guvXMx58Nts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hWUxUbYcOPLCchW4WzN1E1ck/xHYVFTYTTgUE3gZjOSy79CBc+wQ6Iu0QoH4o7RHu 7zeGkQqP84AHmqdX0+ksJJ6awu78f+Ou58vGOJcL12EiRGb+6xu4I/iXbzetwlMZiQ C8ZSigFhrCZ6Zk9bmXec+KoZp/V+xxifgqi+Otck= From: deven.desai@linux.microsoft.com To: agk@redhat.com, axboe@kernel.dk, snitzer@redhat.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, dm-devel@redhat.com, linux-block@vger.kernel.org, jannh@google.com Cc: tyhicks@linux.microsoft.com, pasha.tatashin@soleen.com, sashal@kernel.org, jaskarankhurana@linux.microsoft.com, nramas@linux.microsoft.com, mdsakib@linux.microsoft.com, linux-kernel@vger.kernel.org, corbet@lwn.net Subject: [RFC PATCH v3 07/12] dm-verity: add bdev_setsecurity hook for dm-verity signature Date: Wed, 15 Apr 2020 09:25:45 -0700 Message-Id: <20200415162550.2324-8-deven.desai@linux.microsoft.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200415162550.2324-1-deven.desai@linux.microsoft.com> References: <20200415162550.2324-1-deven.desai@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 From: Deven Bowers Add a security hook call to set a security property of a block_device in dm-verity with the results of a verified, signed root-hash. Signed-off-by: Deven Bowers --- drivers/md/dm-verity-verify-sig.c | 7 +++++++ include/linux/device-mapper.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/md/dm-verity-verify-sig.c b/drivers/md/dm-verity-verify-sig.c index 27dac8aa2e5a..242e2421d3c8 100644 --- a/drivers/md/dm-verity-verify-sig.c +++ b/drivers/md/dm-verity-verify-sig.c @@ -8,7 +8,10 @@ #include #include #include +#include +#include #include +#include "dm-core.h" #include "dm-verity.h" #include "dm-verity-verify-sig.h" @@ -182,6 +185,10 @@ int verity_verify_root_hash(const struct dm_verity *v) goto cleanup; sig_target->passed = true; + + ret = security_bdev_setsecurity(dm_table_get_md(v->ti->table)->bdev, + DM_VERITY_SIGNATURE_SEC_NAME, + v->sig->sig, v->sig->sig_size); cleanup: kfree(root_hash); return ret; diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index af48d9da3916..61c26443783c 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -627,4 +627,6 @@ static inline unsigned long to_bytes(sector_t n) return (n << SECTOR_SHIFT); } +#define DM_VERITY_SIGNATURE_SEC_NAME DM_NAME ".verity-sig" + #endif /* _LINUX_DEVICE_MAPPER_H */ -- 2.26.0