Linux FSCRYPT development
 help / color / mirror / Atom feed
* Re: max fsverity descriptor size?
       [not found] <7F52BBF2-46A8-4854-9B68-1DC3EFA12EF0@fb.com>
@ 2020-12-02 18:12 ` Eric Biggers
  2020-12-02 18:33   ` Chris Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2020-12-02 18:12 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-fscrypt

+linux-fscrypt

On Wed, Dec 02, 2020 at 09:01:52AM -0500, Chris Mason wrote:
> Hi Eric,
> 
> I’m working on fsverity support in btrfs and wanted to check on the max size
> of the descriptor.  I can go up to any size, just wanted to make sure I had
> things correct in the disk format.
> 
> -chris

The implementations of fs-verity in ext4 and f2fs store the built-in signature
(if there is one) appended to the 'struct fsverity_descriptor', and limit the
total size of those two things combined to 16384 bytes.  See
FS_VERITY_MAX_DESCRIPTOR_SIZE in fs/verity/fsverity_private.h.

Note that there's nothing special about this particular number; it's just an
implementation limit to prevent userspace doing weird things with megabytes
"signatures".

If btrfs will be storing built-in signatures in the same way, it probably should
use the same limit.  Preferably it would be done in a way such that it's
possible to increase the limit later if it's ever needed.

- Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: max fsverity descriptor size?
  2020-12-02 18:12 ` max fsverity descriptor size? Eric Biggers
@ 2020-12-02 18:33   ` Chris Mason
  2020-12-02 18:44     ` Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Mason @ 2020-12-02 18:33 UTC (permalink / raw)
  To: Eric Biggers, Boris Burkov; +Cc: linux-fscrypt



On 2 Dec 2020, at 13:12, Eric Biggers wrote:

> +linux-fscrypt
>
> On Wed, Dec 02, 2020 at 09:01:52AM -0500, Chris Mason wrote:
>> Hi Eric,
>>
>> I’m working on fsverity support in btrfs and wanted to check on the 
>> max size
>> of the descriptor.  I can go up to any size, just wanted to make sure 
>> I had
>> things correct in the disk format.
>>
>> -chris
>
> The implementations of fs-verity in ext4 and f2fs store the built-in 
> signature
> (if there is one) appended to the 'struct fsverity_descriptor', and 
> limit the
> total size of those two things combined to 16384 bytes.  See
> FS_VERITY_MAX_DESCRIPTOR_SIZE in fs/verity/fsverity_private.h.
>
> Note that there's nothing special about this particular number; it's 
> just an
> implementation limit to prevent userspace doing weird things with 
> megabytes
> "signatures".
>
> If btrfs will be storing built-in signatures in the same way, it 
> probably should
> use the same limit.  Preferably it would be done in a way such that 
> it's
> possible to increase the limit later if it's ever needed.
>

+Boris

Thanks Eric, the current btrfs code is just putting it in the btree, but 
I’ve got it setup so we won’t run into trouble if it spans multiple 
btree blocks.

Looks like the fs/verity/*.c are in charge of validating against the max 
size?  I’m not finding specific checks in ext4.

-chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: max fsverity descriptor size?
  2020-12-02 18:33   ` Chris Mason
@ 2020-12-02 18:44     ` Eric Biggers
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Biggers @ 2020-12-02 18:44 UTC (permalink / raw)
  To: Chris Mason; +Cc: Boris Burkov, linux-fscrypt

On Wed, Dec 02, 2020 at 01:33:54PM -0500, Chris Mason wrote:
> 
> 
> On 2 Dec 2020, at 13:12, Eric Biggers wrote:
> 
> > +linux-fscrypt
> > 
> > On Wed, Dec 02, 2020 at 09:01:52AM -0500, Chris Mason wrote:
> > > Hi Eric,
> > > 
> > > I’m working on fsverity support in btrfs and wanted to check on the
> > > max size
> > > of the descriptor.  I can go up to any size, just wanted to make
> > > sure I had
> > > things correct in the disk format.
> > > 
> > > -chris
> > 
> > The implementations of fs-verity in ext4 and f2fs store the built-in
> > signature
> > (if there is one) appended to the 'struct fsverity_descriptor', and
> > limit the
> > total size of those two things combined to 16384 bytes.  See
> > FS_VERITY_MAX_DESCRIPTOR_SIZE in fs/verity/fsverity_private.h.
> > 
> > Note that there's nothing special about this particular number; it's
> > just an
> > implementation limit to prevent userspace doing weird things with
> > megabytes
> > "signatures".
> > 
> > If btrfs will be storing built-in signatures in the same way, it
> > probably should
> > use the same limit.  Preferably it would be done in a way such that it's
> > possible to increase the limit later if it's ever needed.
> > 
> 
> +Boris
> 
> Thanks Eric, the current btrfs code is just putting it in the btree, but
> I’ve got it setup so we won’t run into trouble if it spans multiple btree
> blocks.
> 
> Looks like the fs/verity/*.c are in charge of validating against the max
> size?  I’m not finding specific checks in ext4.

Yes, that's the case currently.

- Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-02 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7F52BBF2-46A8-4854-9B68-1DC3EFA12EF0@fb.com>
2020-12-02 18:12 ` max fsverity descriptor size? Eric Biggers
2020-12-02 18:33   ` Chris Mason
2020-12-02 18:44     ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox