SHA256
1
0
forked from pool/grub2

Accepting request 1008353 from home:michael-chang:bsc:1204037

- Fix firmware oops after disk decrypting failure (bsc#1204037) 
  * 0009-Add-crypttab_entry-to-obviate-the-need-to-input-pass.patch

OBS-URL: https://build.opensuse.org/request/show/1008353
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=422
This commit is contained in:
Michael Chang 2022-10-06 08:48:42 +00:00 committed by Git OBS Bridge
parent 90fcdec2e4
commit 3c95b54039
2 changed files with 34 additions and 38 deletions

View File

@ -21,19 +21,17 @@ can also be used multiple times to specify encrypted volumes unlocked by
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
--- ---
grub-core/Makefile.core.def | 5 ++ grub-core/Makefile.core.def | 5 +
grub-core/commands/crypttab.c | 42 ++++++++++++ grub-core/commands/crypttab.c | 42 ++++++++++++
grub-core/disk/cryptodisk.c | 5 ++ grub-core/disk/cryptodisk.c | 6 +
grub-core/loader/linux.c | 126 ++++++++++++++++++++++++++++++++-- grub-core/loader/linux.c | 137 ++++++++++++++++++++++++++++++++++++++++--
include/grub/linux.h | 3 + include/grub/linux.h | 3
5 files changed, 177 insertions(+), 4 deletions(-) 5 files changed, 188 insertions(+), 5 deletions(-)
create mode 100644 grub-core/commands/crypttab.c create mode 100644 grub-core/commands/crypttab.c
Index: grub-2.06/grub-core/Makefile.core.def --- a/grub-core/Makefile.core.def
=================================================================== +++ b/grub-core/Makefile.core.def
--- grub-2.06.orig/grub-core/Makefile.core.def @@ -2643,3 +2643,8 @@
+++ grub-2.06/grub-core/Makefile.core.def
@@ -2643,3 +2643,8 @@ module = {
cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
}; };
@ -42,10 +40,8 @@ Index: grub-2.06/grub-core/Makefile.core.def
+ name = crypttab; + name = crypttab;
+ common = commands/crypttab.c; + common = commands/crypttab.c;
+}; +};
Index: grub-2.06/grub-core/commands/crypttab.c
===================================================================
--- /dev/null --- /dev/null
+++ grub-2.06/grub-core/commands/crypttab.c +++ b/grub-core/commands/crypttab.c
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
+ +
+#include <grub/dl.h> +#include <grub/dl.h>
@ -89,10 +85,8 @@ Index: grub-2.06/grub-core/commands/crypttab.c
+{ +{
+ grub_unregister_command (cmd); + grub_unregister_command (cmd);
+} +}
Index: grub-2.06/grub-core/disk/cryptodisk.c --- a/grub-core/disk/cryptodisk.c
=================================================================== +++ b/grub-core/disk/cryptodisk.c
--- grub-2.06.orig/grub-core/disk/cryptodisk.c
+++ grub-2.06/grub-core/disk/cryptodisk.c
@@ -30,6 +30,8 @@ @@ -30,6 +30,8 @@
#ifdef GRUB_UTIL #ifdef GRUB_UTIL
@ -102,21 +96,19 @@ Index: grub-2.06/grub-core/disk/cryptodisk.c
#endif #endif
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
@@ -1146,6 +1148,10 @@ grub_cryptodisk_scan_device_real (const @@ -1146,6 +1148,10 @@
dev = NULL; dev = NULL;
cleanup: cleanup:
+#ifndef GRUB_UTIL +#ifndef GRUB_UTIL
+ if (cargs->key_data) + if (cargs->key_data && dev)
+ grub_initrd_publish_key (dev->uuid, (const char *)cargs->key_data, cargs->key_len, NULL); + grub_initrd_publish_key (dev->uuid, (const char *)cargs->key_data, cargs->key_len, NULL);
+#endif +#endif
if (askpass) if (askpass)
{ {
cargs->key_len = 0; cargs->key_len = 0;
Index: grub-2.06/grub-core/loader/linux.c --- a/grub-core/loader/linux.c
=================================================================== +++ b/grub-core/loader/linux.c
--- grub-2.06.orig/grub-core/loader/linux.c
+++ grub-2.06/grub-core/loader/linux.c
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
#include <grub/file.h> #include <grub/file.h>
#include <grub/mm.h> #include <grub/mm.h>
@ -125,7 +117,7 @@ Index: grub-2.06/grub-core/loader/linux.c
struct newc_head struct newc_head
{ {
@@ -27,6 +28,7 @@ struct newc_head @@ -27,6 +28,7 @@
struct grub_linux_initrd_component struct grub_linux_initrd_component
{ {
grub_file_t file; grub_file_t file;
@ -133,7 +125,7 @@ Index: grub-2.06/grub-core/loader/linux.c
char *newc_name; char *newc_name;
grub_off_t size; grub_off_t size;
}; };
@@ -38,6 +40,18 @@ struct dir @@ -38,6 +40,18 @@
struct dir *child; struct dir *child;
}; };
@ -152,7 +144,7 @@ Index: grub-2.06/grub-core/loader/linux.c
static char static char
hex (grub_uint8_t val) hex (grub_uint8_t val)
{ {
@@ -149,6 +163,65 @@ insert_dir (const char *name, struct dir @@ -149,6 +163,65 @@
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
@ -218,7 +210,7 @@ Index: grub-2.06/grub-core/loader/linux.c
grub_err_t grub_err_t
grub_initrd_init (int argc, char *argv[], grub_initrd_init (int argc, char *argv[],
struct grub_linux_initrd_context *initrd_ctx) struct grub_linux_initrd_context *initrd_ctx)
@@ -156,11 +229,17 @@ grub_initrd_init (int argc, char *argv[] @@ -156,11 +229,17 @@
int i; int i;
int newc = 0; int newc = 0;
struct dir *root = 0; struct dir *root = 0;
@ -237,7 +229,7 @@ Index: grub-2.06/grub-core/loader/linux.c
if (!initrd_ctx->components) if (!initrd_ctx->components)
return grub_errno; return grub_errno;
@@ -239,7 +318,10 @@ grub_initrd_init (int argc, char *argv[] @@ -239,7 +318,10 @@
free_dir (root); free_dir (root);
root = 0; root = 0;
} }
@ -249,7 +241,7 @@ Index: grub-2.06/grub-core/loader/linux.c
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
overflow: overflow:
@@ -263,7 +345,9 @@ grub_initrd_close (struct grub_linux_ini @@ -263,7 +345,9 @@
for (i = 0; i < initrd_ctx->nfiles; i++) for (i = 0; i < initrd_ctx->nfiles; i++)
{ {
grub_free (initrd_ctx->components[i].newc_name); grub_free (initrd_ctx->components[i].newc_name);
@ -260,7 +252,7 @@ Index: grub-2.06/grub-core/loader/linux.c
} }
grub_free (initrd_ctx->components); grub_free (initrd_ctx->components);
initrd_ctx->components = 0; initrd_ctx->components = 0;
@@ -297,7 +381,7 @@ grub_initrd_load (struct grub_linux_init @@ -297,7 +381,7 @@
} }
ptr += dir_size; ptr += dir_size;
ptr = make_header (ptr, initrd_ctx->components[i].newc_name, ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
@ -269,7 +261,7 @@ Index: grub-2.06/grub-core/loader/linux.c
0100777, 0100777,
initrd_ctx->components[i].size); initrd_ctx->components[i].size);
newc = 1; newc = 1;
@@ -312,7 +396,12 @@ grub_initrd_load (struct grub_linux_init @@ -312,7 +396,12 @@
} }
cursize = initrd_ctx->components[i].size; cursize = initrd_ctx->components[i].size;
@ -283,7 +275,7 @@ Index: grub-2.06/grub-core/loader/linux.c
!= cursize) != cursize)
{ {
if (!grub_errno) if (!grub_errno)
@@ -333,3 +422,41 @@ grub_initrd_load (struct grub_linux_init @@ -333,3 +422,41 @@
root = 0; root = 0;
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
@ -325,11 +317,9 @@ Index: grub-2.06/grub-core/loader/linux.c
+ +
+ return GRUB_ERR_NONE; + return GRUB_ERR_NONE;
+} +}
Index: grub-2.06/include/grub/linux.h --- a/include/grub/linux.h
=================================================================== +++ b/include/grub/linux.h
--- grub-2.06.orig/include/grub/linux.h @@ -22,3 +22,6 @@
+++ grub-2.06/include/grub/linux.h
@@ -22,3 +22,6 @@ grub_initrd_close (struct grub_linux_ini
grub_err_t grub_err_t
grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
char *argv[], void *target); char *argv[], void *target);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Oct 6 07:13:23 UTC 2022 - Michael Chang <mchang@suse.com>
- Fix firmware oops after disk decrypting failure (bsc#1204037)
* 0009-Add-crypttab_entry-to-obviate-the-need-to-input-pass.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Sep 23 10:13:54 UTC 2022 - Michael Chang <mchang@suse.com> Fri Sep 23 10:13:54 UTC 2022 - Michael Chang <mchang@suse.com>