[PATCH] .gitignore: Add po/*.insert-header and factor out po/.gitignore

2018-11-20 Thread Tim Landscheidt
Signed-off-by: Tim Landscheidt 
---
 .gitignore| 10 --
 po/.gitignore | 11 +++
 2 files changed, 11 insertions(+), 10 deletions(-)
 create mode 100644 po/.gitignore

diff --git a/.gitignore b/.gitignore
index eca17bec9..ca2d7b288 100644
--- a/.gitignore
+++ b/.gitignore
@@ -153,10 +153,6 @@ partmap_test
 pata_test
 *.pf2
 *.pp
-po/*.mo
-po/grub.pot
-po/POTFILES
-po/stamp-po
 printf_test
 priority_queue_unit_test
 pseries_test
@@ -227,14 +223,8 @@ widthspec.h
 docs/stamp-1
 docs/version-dev.texi
 Makefile.utilgcry.def
-po/*.po
-po/*.gmo
-po/LINGUAS
-po/remove-potcdate.sed
 include/grub/gcrypt/gcrypt.h
 include/grub/gcrypt/g10lib.h
-po/POTFILES.in
-po/POTFILES-shell.in
 /grub-glue-efi
 /grub-render-label
 /grub-glue-efi.exe
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0..71af96ac4
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,11 @@
+/*.gmo
+/*.insert-header
+/*.mo
+/*.po
+/LINGUAS
+/POTFILES
+/POTFILES-shell.in
+/POTFILES.in
+/grub.pot
+/remove-potcdate.sed
+/stamp-po
-- 
2.17.2


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v3 (part 2)] generic/blocklist: Fix implicit declaration of function ‘grub_file_filter_disable_compression'

2018-11-20 Thread Vladimir 'phcoder' Serbinenko
LGTM

On Tue, 20 Nov 2018, 14:40 Lee Jones,  wrote:

> From: Lee Jones 
>
> generic/blocklist: Fix implicit declaration of function
> ‘grub_file_filter_disable_compression'
>
> grub_file_filter_disable_compression() no longer exists.
>
> Signed-off-by: Lee Jones 
>
> diff --git a/grub-core/osdep/generic/blocklist.c
> b/grub-core/osdep/generic/blocklist.c
> index 74024fd06..43186949d 100644
> --- a/grub-core/osdep/generic/blocklist.c
> +++ b/grub-core/osdep/generic/blocklist.c
> @@ -59,8 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
>
>grub_disk_cache_invalidate_all ();
>
> -  grub_file_filter_disable_compression ();
> -  file = grub_file_open (core_path_dev);
> +  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
>if (file)
> {
>   if (grub_file_size (file) != core_size)
> @@ -117,8 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
>
>grub_file_t file;
>/* Now read the core image to determine where the sectors are.  */
> -  grub_file_filter_disable_compression ();
> -  file = grub_file_open (core_path_dev);
> +  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
>if (! file)
>  grub_util_error ("%s", grub_errmsg);
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Remove duplicate check for arguments

2018-11-20 Thread Vladimir 'phcoder' Serbinenko
On Tue, 20 Nov 2018, 14:40 Lee Jones,  wrote:

> From: Lee Jones 
>
> arm64/xen: Remove duplicate check for arguments
>
It's not duplicate because of argc-- right before it

>
> Signed-off-by: Lee Jones 
>
> diff --git a/grub-core/loader/arm64/xen_boot.c
> b/grub-core/loader/arm64/xen_boot.c
> index 1b1dd8c65..5af15c70d 100644
> --- a/grub-core/loader/arm64/xen_boot.c
> +++ b/grub-core/loader/arm64/xen_boot.c
> @@ -404,12 +404,6 @@ grub_cmd_xen_module (grub_command_t cmd
> __attribute__((unused)),
>argc--;
>  }
>
> -  if (!argc)
> -{
> -  grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> -  goto fail;
> -}
> -
>if (!loaded)
>  {
>grub_error (GRUB_ERR_BAD_ARGUMENT,
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


arm64/xen: Remove duplicate check for arguments

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Remove duplicate check for arguments

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 1b1dd8c65..5af15c70d 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -404,12 +404,6 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
   argc--;
 }
 
-  if (!argc)
-{
-  grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-  goto fail;
-}
-
   if (!loaded)
 {
   grub_error (GRUB_ERR_BAD_ARGUMENT,

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v2] arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_file_open’

Without this fix xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~
In file included from ../include/grub/cache.h:23:0,
 from loader/arm64/xen_boot.c:19:
../include/grub/file.h:204:25: note: declared here
 grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum grub_file_type 
type);
 ^
../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
 # define EXPORT_FUNC(x) x
 ^
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 117293fb9..1b1dd8c65 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -427,7 +427,7 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (!file)
 goto fail;
 
@@ -459,7 +459,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ 
((unused)),
   goto fail;
 }
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (!file)
 goto fail;

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v3 (part 2)] generic/blocklist: Fix implicit declaration of function ‘grub_file_filter_disable_compression'

2018-11-20 Thread Lee Jones
From: Lee Jones 

generic/blocklist: Fix implicit declaration of function 
‘grub_file_filter_disable_compression'

grub_file_filter_disable_compression() no longer exists.

Signed-off-by: Lee Jones 

diff --git a/grub-core/osdep/generic/blocklist.c 
b/grub-core/osdep/generic/blocklist.c
index 74024fd06..43186949d 100644
--- a/grub-core/osdep/generic/blocklist.c
+++ b/grub-core/osdep/generic/blocklist.c
@@ -59,8 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
 
   grub_disk_cache_invalidate_all ();
 
-  grub_file_filter_disable_compression ();
-  file = grub_file_open (core_path_dev);
+  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
   if (file)
{
  if (grub_file_size (file) != core_size)
@@ -117,8 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
 
   grub_file_t file;
   /* Now read the core image to determine where the sectors are.  */
-  grub_file_filter_disable_compression ();
-  file = grub_file_open (core_path_dev);
+  file = grub_file_open (core_path_dev, FILE_TYPE_NO_DECOMPRESS);
   if (! file)
 grub_util_error ("%s", grub_errmsg);

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:
> On 20/11/2018 10:46, Lee Jones wrote:
> > From: Lee Jones 
> > 
> > arm64/xen: Fix implicit declaration of function 
> > ‘grub_file_filter_disable_compression
> 
> This patch seems to drop support for --nounzip. Can you explain why?

It only seemed to serve the invocation of grub_file_filter_disable_compression()
which was removed in this patch.  On closer inspection, I do see that
argv/argc still needs to be shifted though.  I will fix that.

> Note that the option added on Arm64 to keep the compatibility with x86
> multiboot loading.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v3 (part 1)] arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression'

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix implicit declaration of function 
‘grub_file_filter_disable_compression'

Without this fix, building xen_boot.c emits:

loader/arm64/xen_boot.c:433:5: error: implicit declaration of function 
‘grub_file_filter_disable_compression’; did you mean 
‘grub_file_filter_unregister’? [-Werror=implicit-function-declaration]
 grub_file_filter_disable_compression ();
 ^~~~
 grub_file_filter_unregister
loader/arm64/xen_boot.c:433:5: error: nested extern declaration of 
‘grub_file_filter_disable_compression’ [-Werror=nested-externs]

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 7d1adce1b..a01792a72 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -429,9 +429,9 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  if (nounzip)
-grub_file_filter_disable_compression ();
-  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL
+| (nounzip ? GRUB_FILE_TYPE_NO_DECOMPRESS
+   : GRUB_FILE_TYPE_NONE));
   if (!file)
 goto fail;

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:

> Hi,
> 
> On 20/11/2018 11:22, Lee Jones wrote:
> > On Tue, 20 Nov 2018, Julien Grall wrote:
> > > On 20/11/2018 10:46, Lee Jones wrote:
> > > > From: Lee Jones 
> > > > 
> > > > arm64/xen: Fix implicit declaration of function 
> > > > ‘grub_file_filter_disable_compression
> > > 
> > > This patch seems to drop support for --nounzip. Can you explain why?
> > 
> > It only seemed to serve the invocation of 
> > grub_file_filter_disable_compression()
> > which was removed in this patch.
> 
> But --nounzip will not work as expected after this patch. Looking at GRUB,
> it seems the call to that function was replaced by passing
> GRUB_FILE_TYPE_NO_DECOMPRESSION to grub_file_open.

Ah yes, I see.  Please bear with me.

I need to split this patch too.

> Is there any reason to not use it for Arm?

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

Without this fix, building xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘xen_boot_binary_load’:
loader/arm64/xen_boot.c:370:7: error: too few arguments to function 
‘grub_create_loader_cmdline’
   grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
   ^~
In file included from loader/arm64/xen_boot.c:36:0:
../include/grub/lib/cmdline.h:29:12: note: declared here
 grub_err_t grub_create_loader_cmdline (int argc, char *argv[], char *buf,

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 1003a0b99..33a855df4 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -368,7 +368,8 @@ xen_boot_binary_load (struct xen_boot_binary *binary, 
grub_file_t file,
  return;
}
   grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
- binary->cmdline_size);
+ binary->cmdline_size,
+ GRUB_VERIFY_KERNEL_CMDLINE);
   grub_dprintf ("xen_loader",
"Xen_boot cmdline @ %p %s, size: %d\n",
binary->cmdline, binary->cmdline, binary->cmdline_size);

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
On Tue, 20 Nov 2018, Julien Grall wrote:

> Hi Lee,
> 
> On 20/11/2018 10:48, Lee Jones wrote:
> > From: Lee Jones 
> > 
> > arm64/xen: Fix too few arguments to function ‘grub_file_open’
> > Without this fix xen_boot.c omits:
> > loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
> > loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
> > ‘grub_file_open’
> > file = grub_file_open (argv[0]);
> >^~
> > In file included from ../include/grub/cache.h:23:0,
> >   from loader/arm64/xen_boot.c:19:
> > ../include/grub/file.h:204:25: note: declared here
> >   grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum 
> > grub_file_type type);
> >   ^
> > ../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
> >   # define EXPORT_FUNC(x) x
> >   ^
> > loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
> > loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
> > ‘grub_file_open’
> > file = grub_file_open (argv[0]);
> >^~
> > 
> > Signed-off-by: Lee Jones 
> > 
> > diff --git a/grub-core/loader/arm64/xen_boot.c 
> > b/grub-core/loader/arm64/xen_boot.c
> > index 5820412e8..1f49e3278 100644
> > --- a/grub-core/loader/arm64/xen_boot.c
> > +++ b/grub-core/loader/arm64/xen_boot.c
> > @@ -421,7 +421,7 @@ grub_cmd_xen_module (grub_command_t cmd 
> > __attribute__((unused)),
> > grub_dprintf ("xen_loader", "Init module and node info\n");
> > -  file = grub_file_open (argv[0]);
> > +  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
> > if (!file)
> >   goto fail;
> > @@ -453,7 +453,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd 
> > __attribute__ ((unused)),
> > goto fail;
> >   }
> > -  file = grub_file_open (argv[0]);
> > +  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
> 
> I would prefer if we try to keep the type similar to x86 Xen. In that case
> it would be GRUB_FILE_TYPE_LINUX_KERNEL.

Thanks Julien.  Will fix.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Lee Jones
From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_file_open’

Without this fix xen_boot.c omits:

loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:
loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~
In file included from ../include/grub/cache.h:23:0,
 from loader/arm64/xen_boot.c:19:
../include/grub/file.h:204:25: note: declared here
 grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum grub_file_type 
type);
 ^
../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
 # define EXPORT_FUNC(x) x
 ^
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
‘grub_file_open’
   file = grub_file_open (argv[0]);
  ^~

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 5820412e8..1f49e3278 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -421,7 +421,7 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
   if (!file)
 goto fail;
 
@@ -453,7 +453,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ 
((unused)),
   goto fail;
 }
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
   if (!file)
 goto fail;

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Julien Grall

Hi,

On 20/11/2018 11:22, Lee Jones wrote:

On Tue, 20 Nov 2018, Julien Grall wrote:

On 20/11/2018 10:46, Lee Jones wrote:

From: Lee Jones 

arm64/xen: Fix implicit declaration of function 
‘grub_file_filter_disable_compression


This patch seems to drop support for --nounzip. Can you explain why?


It only seemed to serve the invocation of grub_file_filter_disable_compression()
which was removed in this patch.


But --nounzip will not work as expected after this patch. Looking at GRUB, it 
seems the call to that function was replaced by passing 
GRUB_FILE_TYPE_NO_DECOMPRESSION to grub_file_open.


Is there any reason to not use it for Arm?

Cheers,


 On closer inspection, I do see that
argv/argc still needs to be shifted though.  I will fix that.


Note that the option added on Arm64 to keep the compatibility with x86
multiboot loading.




--
Julien Grall

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’

2018-11-20 Thread Julien Grall



On 20/11/2018 10:45, Lee Jones wrote:

From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_create_loader_cmdline’
 
Without this fix, building xen_boot.c omits:
 
loader/arm64/xen_boot.c: In function ‘xen_boot_binary_load’:

loader/arm64/xen_boot.c:370:7: error: too few arguments to function 
‘grub_create_loader_cmdline’
grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
^~
In file included from loader/arm64/xen_boot.c:36:0:
../include/grub/lib/cmdline.h:29:12: note: declared here
  grub_err_t grub_create_loader_cmdline (int argc, char *argv[], char *buf,

Signed-off-by: Lee Jones 


Reviewed-by: Julien Grall 

Cheers,



diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 1003a0b99..33a855df4 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -368,7 +368,8 @@ xen_boot_binary_load (struct xen_boot_binary *binary, 
grub_file_t file,
   return;
 }
grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
- binary->cmdline_size);
+ binary->cmdline_size,
+ GRUB_VERIFY_KERNEL_CMDLINE);
grub_dprintf ("xen_loader",
 "Xen_boot cmdline @ %p %s, size: %d\n",
 binary->cmdline, binary->cmdline, binary->cmdline_size);



--
Julien Grall

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v2] verifiers: fix double close on pgp's sig file descriptor

2018-11-20 Thread Michael Chang
On Fri, Nov 16, 2018 at 03:01:30PM +0100, Daniel Kiper wrote:
> On Thu, Nov 15, 2018 at 06:13:11PM +0800, Michael Chang wrote:
> > An error emerged as when I was tesing the verifiers branch, so instead
> > of putting it in pgp prefix, the verifiers is used to reflect what the
> > patch is based on.
> >
> > While running verify_detached, grub aborts with error.
> >
> > verify_detached /@/.snapshots/1/snapshot/boot/grub/grub.cfg
> > /@/.snapshots/1/snapshot/boot/grub/grub.cfg.sig
> >
> > alloc magic is broken at 0x7beea660: 0
> > Aborted. Press any key to exit.
> >
> > The error is caused by sig file desciptor been closed twice, first time
> > in grub_verify_signature() to which it is passed as parameter. Second in
> > grub_cmd_verify_signature() or in whichever opens the sig file
> > decriptor. The second close is not consider as bug to me either, as in
> > common rule of what opens a file has to close it to avoid file
> > descriptor leakage.
> >
> > Afterall the design of grub_verify_signature() makes it diffcult to keep
> > a good trace on opened file descriptor from it's caller. Let's refine
> > the application interface to accept file path rather than descriptor, in
> > this way the caller doesn't have to care about closing the descriptor by
> > delegating it to grub_verify_signature() with full tracing to opened
> > file descriptor by itself.
> >
> > Signed-off-by: Michael Chang 
> 
> Sadly patch does not apply. Could you rebase it on latest master?

OK. The conflict is caused by new blank line inserted by new commit
which is harmless.

> 
> > v1 -> v2:
> >
> >   - drop change in grub_verify_signature_init()
> 
> If you add a blurb to the commit message why it is needed then I am not
> against it. Even to some extent I am happy with it because it makes code
> a bit nicer.

OK. I'll add that in upcoming v3 patch. :)

Thanks,
Michael

> 
> Daniel
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix too few arguments to function ‘grub_file_open’

2018-11-20 Thread Julien Grall

Hi Lee,

On 20/11/2018 10:48, Lee Jones wrote:

From: Lee Jones 

arm64/xen: Fix too few arguments to function ‘grub_file_open’
 
Without this fix xen_boot.c omits:
 
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_module’:

loader/arm64/xen_boot.c:424:10: error: too few arguments to function 
‘grub_file_open’
file = grub_file_open (argv[0]);
   ^~
In file included from ../include/grub/cache.h:23:0,
  from loader/arm64/xen_boot.c:19:
../include/grub/file.h:204:25: note: declared here
  grub_file_t EXPORT_FUNC(grub_file_open) (const char *name, enum 
grub_file_type type);
  ^
../include/grub/symbol.h:68:25: note: in definition of macro ‘EXPORT_FUNC’
  # define EXPORT_FUNC(x) x
  ^
loader/arm64/xen_boot.c: In function ‘grub_cmd_xen_hypervisor’:
loader/arm64/xen_boot.c:456:10: error: too few arguments to function 
‘grub_file_open’
file = grub_file_open (argv[0]);
   ^~

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 5820412e8..1f49e3278 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -421,7 +421,7 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
  
grub_dprintf ("xen_loader", "Init module and node info\n");
  
-  file = grub_file_open (argv[0]);

+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);
if (!file)
  goto fail;
  
@@ -453,7 +453,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),

goto fail;
  }
  
-  file = grub_file_open (argv[0]);

+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_NONE);


I would prefer if we try to keep the type similar to x86 Xen. In that case it 
would be GRUB_FILE_TYPE_LINUX_KERNEL.


Cheers,

--
Julien Grall

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: arm64/xen: Fix implicit declaration of function ‘grub_file_filter_disable_compression

2018-11-20 Thread Julien Grall

Hi,

On 20/11/2018 10:46, Lee Jones wrote:

From: Lee Jones 

arm64/xen: Fix implicit declaration of function 
‘grub_file_filter_disable_compression


This patch seems to drop support for --nounzip. Can you explain why?

Note that the option added on Arm64 to keep the compatibility with x86 multiboot 
loading.


Cheers,

 
Without this fix, building xen_boot.c omits:
 
loader/arm64/xen_boot.c:433:5: error: implicit declaration of function ‘grub_file_filter_disable_compression’; did you mean ‘grub_file_filter_unregister’? [-Werror=implicit-function-declaration]

  grub_file_filter_disable_compression ();
  ^~~~
  grub_file_filter_unregister
loader/arm64/xen_boot.c:433:5: error: nested extern declaration of 
‘grub_file_filter_disable_compression’ [-Werror=nested-externs]

Signed-off-by: Lee Jones 

diff --git a/grub-core/loader/arm64/xen_boot.c 
b/grub-core/loader/arm64/xen_boot.c
index 33a855df4..5820412e8 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -391,7 +391,6 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
  
struct xen_boot_binary *module = NULL;

grub_file_t file = 0;
-  int nounzip = 0;
  
if (!argc)

  {
@@ -399,13 +398,6 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
goto fail;
  }
  
-  if (grub_strcmp (argv[0], "--nounzip") == 0)

-{
-  argv++;
-  argc--;
-  nounzip = 1;
-}
-
if (!argc)
  {
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@@ -429,8 +421,6 @@ grub_cmd_xen_module (grub_command_t cmd 
__attribute__((unused)),
  
grub_dprintf ("xen_loader", "Init module and node info\n");
  
-  if (nounzip)

-grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (!file)
  goto fail;
diff --git a/grub-core/osdep/generic/blocklist.c 
b/grub-core/osdep/generic/blocklist.c
index 74024fd06..63e0aed35 100644
--- a/grub-core/osdep/generic/blocklist.c
+++ b/grub-core/osdep/generic/blocklist.c
@@ -59,7 +59,6 @@ grub_install_get_blocklist (grub_device_t root_dev,
  
grub_disk_cache_invalidate_all ();
  
-  grub_file_filter_disable_compression ();

file = grub_file_open (core_path_dev);
if (file)
{
@@ -117,7 +116,6 @@ grub_install_get_blocklist (grub_device_t root_dev,
  
grub_file_t file;

/* Now read the core image to determine where the sectors are.  */
-  grub_file_filter_disable_compression ();
file = grub_file_open (core_path_dev);
if (! file)
  grub_util_error ("%s", grub_errmsg);



--
Julien Grall

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v4 10/19] xen: setup hypercall page for PVH

2018-11-20 Thread Juergen Gross
On 09/11/2018 19:12, Daniel Kiper wrote:
> On Fri, Nov 02, 2018 at 01:37:29PM +0100, Juergen Gross wrote:
>> Add the needed code to setup the hypercall page for calling into the
>> Xen hypervisor.
>>
>> Signed-off-by: Juergen Gross 
>> ---
>> V3: grub_xen_early_halt->grub_xen_panic (Roger Pau Monné)
>> issue panic message (Roger Pau Monné)
>> rewrite grub_xen_hypercall to avoid register variables (Daniel Kiper)
>> ---
>>  grub-core/kern/i386/xen/pvh.c | 69 
>> +++
>>  1 file changed, 69 insertions(+)
>>
>> diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c
>> index ac6181f4e..7e90a4538 100644
>> --- a/grub-core/kern/i386/xen/pvh.c
>> +++ b/grub-core/kern/i386/xen/pvh.c
>> @@ -20,14 +20,83 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>  #include 
>>  #include 
>>
>> +#define XEN_CONSOLE_PORT   0xe9
> 
> I think that this is not PVH specific thing. Could you move this to
> more generic Xen header?
> 
>>  grub_uint64_t grub_rsdp_addr;
> 
> Hmmm... It seems to me that immediately after patch #8 GRUB2 build is
> broken. Is not it?

No. xen-pvh isn't yet selectable.

> 
>> +static char hypercall_page[GRUB_XEN_PAGE_SIZE]
>> +  __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));
>> +
>> +static grub_uint32_t xen_cpuid_base;
>> +
>> +static void
>> +grub_xen_panic (const char *msg)
>> +{
>> +  const char *c;
>> +
>> +  for (c = msg; *c; c++)
>> +grub_outb (*c, XEN_CONSOLE_PORT);
>> +
>> +  asm volatile ("hlt");
> 
> Should not you do something similar to grub-core/lib/i386/halt.c:stop() here?

Yes, as already replied to Roger.

> 
>> +}
>> +
>> +static void
>> +grub_xen_cpuid_base (void)
>> +{
>> +  grub_uint32_t base, eax, signature[3];
>> +
>> +  for (base = 0x4000; base < 0x4001; base += 0x100)
>> +{
>> +  grub_cpuid (base, eax, signature[0], signature[1], signature[2]);
>> +  if (!grub_memcmp ("XenVMMXenVMM", signature, 12) && (eax - base) >= 2)
>> +{
>> +  xen_cpuid_base = base;
>> +  return;
>> +}
>> +}
>> +
>> +  grub_xen_panic ("Found no Xen signature.\n");
> 
> "Found no Xen signature!\nSystem halted!\n"
> 
> Or maybe grub_xen_panic() should always add "System halted!\n".

Okay (the latter).

> 
>> +}
>> +
>> +static void
>> +grub_xen_setup_hypercall_page (void)
>> +{
>> +  grub_uint32_t msr, pfn, eax, ebx, ecx, edx;
>> +
>> +  grub_cpuid (xen_cpuid_base + 2, eax, ebx, ecx, edx);
>> +  msr = ebx;
>> +  pfn = (grub_uint32_t) (_page[0]);
> 
> Could not you use hypercall_page alone here?

Hmm, yes.

> 
>> +
>> +  asm volatile ("wrmsr" : : "c" (msr), "a" (pfn), "d" (0) : "memory");
>> +}
>> +
>> +int
>> +grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,
>> +grub_uint32_t a1, grub_uint32_t a2,
>> +grub_uint32_t a3, grub_uint32_t a4,
>> +grub_uint32_t a5 __attribute__ ((unused)))
>> +{
>> +  grub_uint32_t __res, __ign0, __ign1, __ign2, __ign3, __ign4;
>> +
>> +  asm volatile ("call *%[callno]"
>> +: "=a" (__res), "=b" (__ign0), "=c" (__ign1), "=d" (__ign2),
>> +  "=S" (__ign3), "=D" (__ign4)
>> +: "1" (a0), "2" (a1), "3" (a2), "4" (a3), "5" (a4),
> 
> I think that you can drop all __ign* variables if you specify proper
> registers in input argument. If this does not work you can use "+"
> modifier instead of "=" in the output argument.

I'll have a try.


Juergen


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [Xen-devel] [PATCH v4 10/19] xen: setup hypercall page for PVH

2018-11-20 Thread Juergen Gross
On 15/11/2018 09:33, Roger Pau Monné wrote:
> On Fri, Nov 02, 2018 at 01:37:29PM +0100, Juergen Gross wrote:
>> Add the needed code to setup the hypercall page for calling into the
>> Xen hypervisor.
>>
>> Signed-off-by: Juergen Gross 
> 
> Thanks, LGTM, just one suggestion and one question.
> 
>> ---
>> V3: grub_xen_early_halt->grub_xen_panic (Roger Pau Monné)
>> issue panic message (Roger Pau Monné)
>> rewrite grub_xen_hypercall to avoid register variables (Daniel Kiper)
>> ---
>>  grub-core/kern/i386/xen/pvh.c | 69 
>> +++
>>  1 file changed, 69 insertions(+)
>>
>> diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c
>> index ac6181f4e..7e90a4538 100644
>> --- a/grub-core/kern/i386/xen/pvh.c
>> +++ b/grub-core/kern/i386/xen/pvh.c
>> @@ -20,14 +20,83 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>  #include 
>>  #include 
>>  
>> +#define XEN_CONSOLE_PORT   0xe9
> 
> This is now part of the public headers (XEN_HVM_DEBUGCONS_IOPORT) if
> you wish to pick it up from there.

I don't want to import headers from Xen unstable, so I'll add just that
define (and the associated comment) to include/xen/arch-x86/xen.h

> 
>> +
>>  grub_uint64_t grub_rsdp_addr;
>>  
>> +static char hypercall_page[GRUB_XEN_PAGE_SIZE]
>> +  __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));
>> +
>> +static grub_uint32_t xen_cpuid_base;
>> +
>> +static void
>> +grub_xen_panic (const char *msg)
>> +{
>> +  const char *c;
>> +
>> +  for (c = msg; *c; c++)
>> +grub_outb (*c, XEN_CONSOLE_PORT);
>> +
>> +  asm volatile ("hlt");
> 
> Should this be "cli; hlt;", or does grub always runs with interrupt flag
> clear?

Good point. Maybe I should even add a loop around the hlt.


Juergen


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel