lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd6f4726-692b-4537-8bb4-a0466f24d713@linux.microsoft.com>
Date: Fri, 2 Feb 2024 19:56:53 -0800
From: Fan Wu <wufan@...ux.microsoft.com>
To: Mike Snitzer <snitzer@...nel.org>
Cc: corbet@....net, zohar@...ux.ibm.com, jmorris@...ei.org, serge@...lyn.com,
 tytso@....edu, ebiggers@...nel.org, axboe@...nel.dk, agk@...hat.com,
 eparis@...hat.com, paul@...l-moore.com, linux-doc@...r.kernel.org,
 linux-integrity@...r.kernel.org, linux-security-module@...r.kernel.org,
 linux-fscrypt@...r.kernel.org, linux-block@...r.kernel.org,
 dm-devel@...ts.linux.dev, audit@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v12 12/20] dm verity: set DM_TARGET_SINGLETON feature
 flag



On 2/2/2024 10:51 AM, Mike Snitzer wrote:
> On Tue, Jan 30 2024 at  5:37P -0500,
> Fan Wu <wufan@...ux.microsoft.com> wrote:
> 
>> The device-mapper has a flag to mark targets as singleton, which is a
>> required flag for immutable targets. Without this flag, multiple
>> dm-verity targets can be added to a mapped device, which has no
>> practical use cases and will let dm_table_get_immutable_target return
>> NULL. This patch adds the missing flag, restricting only one
>> dm-verity target per mapped device.
>>
>> Signed-off-by: Fan Wu <wufan@...ux.microsoft.com>
>>
>> ---
>> v1-v10:
>>    + Not present
>>
>> v11:
>>    + Introduced
>>
>> v12:
>>    + No changes
>> ---
>>   drivers/md/dm-verity-target.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
>> index 14e58ae70521..66a850c02be4 100644
>> --- a/drivers/md/dm-verity-target.c
>> +++ b/drivers/md/dm-verity-target.c
>> @@ -1507,7 +1507,7 @@ int dm_verity_get_root_digest(struct dm_target *ti, u8 **root_digest, unsigned i
>>   
>>   static struct target_type verity_target = {
>>   	.name		= "verity",
>> -	.features	= DM_TARGET_IMMUTABLE,
>> +	.features	= DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE,
>>   	.version	= {1, 9, 0},
>>   	.module		= THIS_MODULE,
>>   	.ctr		= verity_ctr,
>> -- 
>> 2.43.0
>>
>>
> 
> It is true this change will cause dm_table_get_immutable_target() to
> not return NULL, but: I'm curious how that is meaningful in the
> context of dm-verity? (given the only caller of
> dm_table_get_immutable_target() is request-based DM code in DM core.)
> 
> Thanks,
> Mike

Sorry for the confusion. The reference of 
dm_table_get_immutable_target() is only to justify an immutable target 
should also be a 
singleton(https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/md/dm-table.c#n982). 
It is not directly related to dm-verity.

In the context of dm-verity. I found although veritysetup does ensure 
the dm-verity target as a singleton, users can still use dmsetup to 
configure multiple dm-verity targets within a single map table. This 
leads to a situation where only the first target can be accessed. 
Therefore to prevent this and similar misuse, I propose introducing 
DM_TARGET_SINGLETON to allow the kernel to enforce dm-verity targets as 
singletons.

Thanks,
Fan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ