* [PATCH] luks2: Continue trying all keyslots even if there are some failures
@ 2022-07-22 8:04 Glenn Washburn
2022-08-02 10:46 ` Daniel Kiper
2022-08-15 15:23 ` Patrick Steinhardt
0 siblings, 2 replies; 5+ messages in thread
From: Glenn Washburn @ 2022-07-22 8:04 UTC (permalink / raw)
To: grub-devel, Daniel Kiper; +Cc: Patrick Steinhardt, Glenn Washburn
luks2_get_keyslot can fail for a variety of reasons that do not neccesarily
mean the next keyslot should not be tried (eg. a new kdf type). So always
try the next slot. This will make GRUB more resilient to non-spec json data
that 3rd party systems may add. We do not care if some of the keyslots are
unusable, only if there is at least one that is.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/disk/luks2.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index bf741d70f..d8d3180ed 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -610,7 +610,15 @@ luks2_recover_key (grub_disk_t source,
grub_errno = GRUB_ERR_NONE;
ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
if (ret)
- goto err;
+ {
+ /*
+ * luks2_get_keyslot can fail for a variety of reasons that do not
+ * neccesarily mean the next keyslot should not be tried (eg. a new
+ * kdf type). So always try the next slot.
+ */
+ grub_dprintf ("luks2", "Failed to get keyslot %" PRIuGRUB_UINT64_T "\n", keyslot.idx);
+ continue;
+ }
if (grub_errno != GRUB_ERR_NONE)
grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] luks2: Continue trying all keyslots even if there are some failures
2022-07-22 8:04 [PATCH] luks2: Continue trying all keyslots even if there are some failures Glenn Washburn
@ 2022-08-02 10:46 ` Daniel Kiper
2022-08-15 15:23 ` Patrick Steinhardt
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Kiper @ 2022-08-02 10:46 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel, Patrick Steinhardt
On Fri, Jul 22, 2022 at 03:04:50AM -0500, Glenn Washburn wrote:
> luks2_get_keyslot can fail for a variety of reasons that do not neccesarily
> mean the next keyslot should not be tried (eg. a new kdf type). So always
> try the next slot. This will make GRUB more resilient to non-spec json data
> that 3rd party systems may add. We do not care if some of the keyslots are
> unusable, only if there is at least one that is.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] luks2: Continue trying all keyslots even if there are some failures
2022-07-22 8:04 [PATCH] luks2: Continue trying all keyslots even if there are some failures Glenn Washburn
2022-08-02 10:46 ` Daniel Kiper
@ 2022-08-15 15:23 ` Patrick Steinhardt
2022-08-19 14:10 ` Daniel Kiper
1 sibling, 1 reply; 5+ messages in thread
From: Patrick Steinhardt @ 2022-08-15 15:23 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel, Daniel Kiper
[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]
On Fri, Jul 22, 2022 at 03:04:50AM -0500, Glenn Washburn wrote:
> luks2_get_keyslot can fail for a variety of reasons that do not neccesarily
> mean the next keyslot should not be tried (eg. a new kdf type). So always
> try the next slot. This will make GRUB more resilient to non-spec json data
> that 3rd party systems may add. We do not care if some of the keyslots are
> unusable, only if there is at least one that is.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
> grub-core/disk/luks2.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> index bf741d70f..d8d3180ed 100644
> --- a/grub-core/disk/luks2.c
> +++ b/grub-core/disk/luks2.c
> @@ -610,7 +610,15 @@ luks2_recover_key (grub_disk_t source,
> grub_errno = GRUB_ERR_NONE;
> ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
> if (ret)
> - goto err;
> + {
> + /*
> + * luks2_get_keyslot can fail for a variety of reasons that do not
> + * neccesarily mean the next keyslot should not be tried (eg. a new
> + * kdf type). So always try the next slot.
> + */
> + grub_dprintf ("luks2", "Failed to get keyslot %" PRIuGRUB_UINT64_T "\n", keyslot.idx);
> + continue;
> + }
> if (grub_errno != GRUB_ERR_NONE)
> grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
>
> --
> 2.34.1
>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] luks2: Continue trying all keyslots even if there are some failures
2022-08-15 15:23 ` Patrick Steinhardt
@ 2022-08-19 14:10 ` Daniel Kiper
2022-08-20 9:02 ` Patrick Steinhardt
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Kiper @ 2022-08-19 14:10 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: Glenn Washburn, grub-devel
On Mon, Aug 15, 2022 at 05:23:15PM +0200, Patrick Steinhardt wrote:
> On Fri, Jul 22, 2022 at 03:04:50AM -0500, Glenn Washburn wrote:
> > luks2_get_keyslot can fail for a variety of reasons that do not neccesarily
> > mean the next keyslot should not be tried (eg. a new kdf type). So always
> > try the next slot. This will make GRUB more resilient to non-spec json data
> > that 3rd party systems may add. We do not care if some of the keyslots are
> > unusable, only if there is at least one that is.
> >
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> > grub-core/disk/luks2.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> > index bf741d70f..d8d3180ed 100644
> > --- a/grub-core/disk/luks2.c
> > +++ b/grub-core/disk/luks2.c
> > @@ -610,7 +610,15 @@ luks2_recover_key (grub_disk_t source,
> > grub_errno = GRUB_ERR_NONE;
> > ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
> > if (ret)
> > - goto err;
> > + {
> > + /*
> > + * luks2_get_keyslot can fail for a variety of reasons that do not
> > + * neccesarily mean the next keyslot should not be tried (eg. a new
> > + * kdf type). So always try the next slot.
> > + */
> > + grub_dprintf ("luks2", "Failed to get keyslot %" PRIuGRUB_UINT64_T "\n", keyslot.idx);
> > + continue;
> > + }
> > if (grub_errno != GRUB_ERR_NONE)
> > grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
> >
> > --
> > 2.34.1
> >
>
> Reviewed-by: Patrick Steinhardt <ps@pks.im>
Thank you for review but I have merged this patch earlier and cannot add
your RB now... :-(
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] luks2: Continue trying all keyslots even if there are some failures
2022-08-19 14:10 ` Daniel Kiper
@ 2022-08-20 9:02 ` Patrick Steinhardt
0 siblings, 0 replies; 5+ messages in thread
From: Patrick Steinhardt @ 2022-08-20 9:02 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: Glenn Washburn
[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]
On Fri, Aug 19, 2022 at 04:10:44PM +0200, Daniel Kiper wrote:
> On Mon, Aug 15, 2022 at 05:23:15PM +0200, Patrick Steinhardt wrote:
> > On Fri, Jul 22, 2022 at 03:04:50AM -0500, Glenn Washburn wrote:
> > > luks2_get_keyslot can fail for a variety of reasons that do not neccesarily
> > > mean the next keyslot should not be tried (eg. a new kdf type). So always
> > > try the next slot. This will make GRUB more resilient to non-spec json data
> > > that 3rd party systems may add. We do not care if some of the keyslots are
> > > unusable, only if there is at least one that is.
> > >
> > > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > > ---
> > > grub-core/disk/luks2.c | 10 +++++++++-
> > > 1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> > > index bf741d70f..d8d3180ed 100644
> > > --- a/grub-core/disk/luks2.c
> > > +++ b/grub-core/disk/luks2.c
> > > @@ -610,7 +610,15 @@ luks2_recover_key (grub_disk_t source,
> > > grub_errno = GRUB_ERR_NONE;
> > > ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
> > > if (ret)
> > > - goto err;
> > > + {
> > > + /*
> > > + * luks2_get_keyslot can fail for a variety of reasons that do not
> > > + * neccesarily mean the next keyslot should not be tried (eg. a new
> > > + * kdf type). So always try the next slot.
> > > + */
> > > + grub_dprintf ("luks2", "Failed to get keyslot %" PRIuGRUB_UINT64_T "\n", keyslot.idx);
> > > + continue;
> > > + }
> > > if (grub_errno != GRUB_ERR_NONE)
> > > grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
> > >
> > > --
> > > 2.34.1
> > >
> >
> > Reviewed-by: Patrick Steinhardt <ps@pks.im>
>
> Thank you for review but I have merged this patch earlier and cannot add
> your RB now... :-(
>
> Daniel
No worries! I assumed as much when I reviewed this but was too lazy to
check ;)
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-20 9:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22 8:04 [PATCH] luks2: Continue trying all keyslots even if there are some failures Glenn Washburn
2022-08-02 10:46 ` Daniel Kiper
2022-08-15 15:23 ` Patrick Steinhardt
2022-08-19 14:10 ` Daniel Kiper
2022-08-20 9:02 ` Patrick Steinhardt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.