From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45A795680 for ; Mon, 5 May 2025 21:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746478912; cv=none; b=CkZsX0hJxYaTqpZMSWe4ALNCUDYyw0NKFDnJPSralbitOT4m8VBVA5zn4B6LaXftEXEsE+nxY34eSxJ9Sv44dAFKreSjFXEKN7f2ocAyD3NiuRPF/eurmHGB8/UUc3gre1HsrXiB/HfwBg2i78+/0VZ3EumHVVPlSIIOmHpr03k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746478912; c=relaxed/simple; bh=rTFXvpoFOiDsJ0MIB+jbnVwtIFoe/zbuCTQ6dEySNdc=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=bL9l1bIaqc9ZUF0fyuGxH64y0+D6VCwVTrgdBZVEamZmGf/uSaXyTe5VI8JGN0nUrkLk8gVzQ30+cbAIQRQ3Vp+a2dAyQgEG2ayVlXW9plaIWG4Tp62coHDuT6nH91P/YgBeeZNW9PhFunHeE48XVXC06AXAM6hEUDv0CyFVFiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Y+KVArNz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y+KVArNz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746478910; 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: in-reply-to:in-reply-to:references:references; bh=lkCRFfNqatPCh1SRs3dEvTgyEfbqqLQiDH+3i3waEkI=; b=Y+KVArNz/LLoNm5cVC2UU7ubiJrF1+8d7ByZls+bttoOGPbfCt3tV0gsdU29H4lHyo/V3E yUWp8P2Mj1PRZzXohEvDB12qeE+B6PPAZvCCmiRuF9SC+ywwzYVx/IFticgAIirblnGSqe ubuE0PkhjOQbGVeON6D1DAUNXB/RxNo= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-F1MtIffoMpi8p4RZ4ZYCEw-1; Mon, 05 May 2025 17:01:47 -0400 X-MC-Unique: F1MtIffoMpi8p4RZ4ZYCEw-1 X-Mimecast-MFC-AGG-ID: F1MtIffoMpi8p4RZ4ZYCEw_1746478905 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 74CAE1955E8C; Mon, 5 May 2025 21:01:45 +0000 (UTC) Received: from [10.22.80.45] (unknown [10.22.80.45]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9337430001A2; Mon, 5 May 2025 21:01:42 +0000 (UTC) Date: Mon, 5 May 2025 23:01:38 +0200 (CEST) From: Mikulas Patocka To: Eric Biggers cc: dm-devel@lists.linux.dev, Alasdair Kergon , Mike Snitzer , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fscrypt@vger.kernel.org, Bartosz Golaszewski , Gaurav Kashyap Subject: Re: [PATCH v2 2/2] dm: pass through operations on wrapped inline crypto keys In-Reply-To: <20250505170336.GA197153@sol> Message-ID: <5ca7e728-96ed-4419-6689-f36081b7e2da@redhat.com> References: <20250501212320.8281-1-ebiggers@kernel.org> <20250501212320.8281-3-ebiggers@kernel.org> <20250505170336.GA197153@sol> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On Mon, 5 May 2025, Eric Biggers wrote: > On Mon, May 05, 2025 at 06:15:01PM +0200, Mikulas Patocka wrote: > > > > I have a dumb question - if it doesn't matter through which block device > > do you set up the keys, why do you set them up through a block device at > > all? > > > > What about making functions that set up the keys without taking block > > device as an argument, calling these functions directly and bypassing > > device mapper entirely? > > Userspace needs to direct the key setup operations, so we'd need a UAPI for it > to do so. We could add a custom syscall, or some hacked-up extension of > add_key(), and add a custom registration mechanism to allow a single > implementation of wrapped keys (e.g. from ufs-qcom) to register itself as the What happens if there are multiple ufs-qcom controllers? Is it unsupported? > system's wrapped key provider which the syscall would then use. > > But it seemed cleaner to instead use block device ioctls and take advantage of > the existing blk-crypto-profile. That already handles registering and > unregistering the implementation, and it also already handles things like > locking, and resuming the UFS controller if it's in suspend. > > It also keeps the door open to supporting the case where different > wrapped-key-capable block devices don't necessarily accept the same keys, even > if that isn't the case currently. > > - Eric I think that using ioctl on block device is ok. But I don't see why do you need to perform the ioctl on device mapper device and let device mapper select a random underlying device where the ioctl is forwarded? You can as well select a random physical disk in your userspace application and call the ioctl on it. Mikulas