Re: [PATCH] configure: Add -fno-ident when available

2019-07-11 Thread Daniel Kiper
On Tue, Jul 09, 2019 at 05:52:58PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> On mingw i386-pc without this option mingw generates a
> rdata$zzz symbol that is page-aligned and hence lzma_decompress no
> longer fits in its allocated space.

Out of curiosity, why is the size of lzma_decompress limited to an
value? I thought that the total size of core.img is limited not
lzma_decompress module.

> With mingw this also saves a bit of space in modules
> On other platforms we should already strip this, so no effect

May I ask you to polish a comment a bit. And please add your SOB.

> ---
>  configure.ac | 23 +++
>  1 file changed, 23 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 7656f2434..a86951b90 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -999,6 +999,29 @@ if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
>TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
>  fi
>
> +# Do not generate .ident sections
> +AC_CACHE_CHECK([whether -fno-ident works], [grub_cv_cc_fno_ident], [
> +  CFLAGS="$TARGET_CFLAGS -fno-ident"
> +  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> +  [grub_cv_cc_fno_ident=yes],
> +  [grub_cv_cc_fno_ident=no])
> +])
> +
> +if test "x$grub_cv_cc_fno_ident" = xyes; then
> +  TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
> +fi

OK...

> +
> +AC_CACHE_CHECK([whether -fno-unwind-tables works],
> [grub_cv_cc_fno_unwind_tables], [
> +  CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
> +  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> +  [grub_cv_cc_fno_unwind_tables=yes],
> +  [grub_cv_cc_fno_unwind_tables=no])
> +])
> +
> +if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
> +  TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
> +fi
> +

...but I am afraid that you copied this part from above by mistake.
Could you drop that?

Daniel

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


Re: [PATCH] configure: disable arm movw/movt relocations for GCC

2019-07-11 Thread Daniel Kiper
On Tue, Jun 04, 2019 at 01:49:51PM +0200, Alexander Graf wrote:
> On 04.06.19 13:39, Leif Lindholm wrote:
> > When building for arm, we already disable movw/movt relocations for clang,
> > since they are incompatible with PE.
> >
> > When building with bare metal GCC toolchains (like the one used in the
> > travis ci scripts), we end up with these relocations again. So add an
> > additional test for the '-mword-relocations' flag used by GCC.
> >
> > Reported-by: Alexander Graf 
> > Signed-off-by: Leif Lindholm 
>
> Reviewed-by: Alexander Graf 

Reviewed-by: Daniel Kiper 

Daniel

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


Re: [PATCH] riscv: fix computation of pc-relative relocation offset

2019-07-11 Thread Daniel Kiper
On Tue, Jul 09, 2019 at 07:06:45AM +, Chester Lin wrote:
> On Wed, Jun 26, 2019 at 16:50:03 +0200, Andreas Schwab wrote:
> > The offset calculation was missing the relocation addend.
> >
> > Signed-off-by: Andreas Schwab 
> > ---
> >  util/grub-mkimagexx.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
> > index bc087c2b5..d16ec63a1 100644
> > --- a/util/grub-mkimagexx.c
> > +++ b/util/grub-mkimagexx.c
> > @@ -1232,8 +1232,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct 
> > section_metadata *smd,
> >  grub_uint32_t *t32 = (grub_uint32_t *) target;
> >  grub_uint16_t *t16 = (grub_uint16_t *) target;
> >  grub_uint8_t *t8 = (grub_uint8_t *) target;
> > -grub_int64_t off = (long)sym_addr - target_section_addr - 
> > offset
> > -   - image_target->vaddr_offset;
> > +grub_int64_t off;
> >
> >  /*
> >   * Instructions and instruction encoding are documented in the 
> > RISC-V
> > @@ -1243,6 +1242,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct 
> > section_metadata *smd,
> >   */
> >
> >  sym_addr += addend;
> > +off = sym_addr - target_section_addr - offset - 
> > image_target->vaddr_offset;
> >
> >  switch (ELF_R_TYPE (info))
> >{
>
> This patch can fix a grub abort issue which randomly shows 'unaligned pointer'
> warnings on console. I tried this patch on QEMU v4.0.50 + grub-2.0.4-rc1.
>
> Tested-by: Chester Lin 

Reviewed-by: Daniel Kiper 

Daniel

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


Re: [PATCH] cryptodisk: add luks_recover_key attempts

2019-07-11 Thread Daniel Kiper
Sorry for late reply but I was busy with release and other stuff.

On Sat, Jun 29, 2019 at 09:44:51PM -0400, Jason Kushmaul wrote:
> Add a configurable option for luks key recovery.  Existing
> users will continue to have the default of 1 attempt.
>
> Cryptodisk is not accessible to motor impaired individuals
> who may need the extra attempts without having to reboot or
> manually rescue only to be asked again.

I like the longer comment which you put in one of your earlier emails.
So, please move it here.

> Reported-by: Jason J. Kushmaul 

Missing SOB.

> ---
>  docs/grub.texi   | 10 +++--
>  grub-core/disk/cryptodisk.c  | 24 +++---
>  grub-core/disk/luks.c| 35 +---
>  grub-core/osdep/aros/config.c| 16 +++
>  grub-core/osdep/unix/config.c| 20 --
>  grub-core/osdep/windows/config.c | 16 +++
>  include/grub/emu/config.h|  1 +
>  util/config.c| 14 +
>  util/grub-install.c  | 12 +--
>  9 files changed, 128 insertions(+), 20 deletions(-)
>
> diff --git a/docs/grub.texi b/docs/grub.texi
> index 308b25074..00df49fa1 100644
> --- a/docs/grub.texi
> +++ b/docs/grub.texi
> @@ -1508,6 +1508,11 @@ check for encrypted disks and generate additional
> commands needed to access
>  them during boot.  Note that in this case unattended boot is not possible
>  because GRUB will wait for passphrase to unlock encrypted container.
>
> +@item GRUB_CRYPTODISK_ATTEMPTS
> +If set, @command{grub-install} will allow the provided number of attempts
> +on key recovery.  The default if not present, or outside of [1,256] is 1.
> +Currently only supported for LUKS.
> +
>  @item GRUB_INIT_TUNE
>  Play a tune on the speaker when GRUB starts.  This is particularly useful
>  for users unable to see the screen.  The value of this option is passed
> @@ -4194,12 +4199,13 @@ Alias for @code{hashsum --hash crc32 arg @dots{}}.
> See command @command{hashsum}
>  @node cryptomount
>  @subsection cryptomount
>
> -@deffn Command cryptomount device|@option{-u} uuid|@option{-a}|@option{-b}
> +@deffn Command cryptomount [@option{-t} tries] device|@option{-u}
> uuid|@option{-a}|@option{-b}
>  Setup access to encrypted device. If necessary, passphrase
>  is requested interactively. Option @var{device} configures specific grub
> device
>  (@pxref{Naming convention}); option @option{-u} @var{uuid} configures
> device
>  with specified @var{uuid}; option @option{-a} configures all detected
> encrypted
> -devices; option @option{-b} configures all geli containers that have boot
> flag set.
> +devices; option @option{-b} configures all geli containers that have boot
> flag set;
> +option @option{-t}, luks only, configures passphrase retry attempts,

s/luks/LUKS/ Please be consistent with the rest of the documentation...

> defaulting to 1.
>
>  GRUB suports devices encrypted using LUKS and geli. Note that necessary
> modules (@var{luks} and @var{geli}) have to be loaded manually before this
> command can
>  be used.
> diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
> index 5037768fc..3b90e550e 100644
> --- a/grub-core/disk/cryptodisk.c
> +++ b/grub-core/disk/cryptodisk.c
> @@ -41,6 +41,7 @@ static const struct grub_arg_option options[] =
>  /* TRANSLATORS: It's still restricted to cryptodisks only.  */
>  {"all", 'a', 0, N_("Mount all."), 0, 0},
>  {"boot", 'b', 0, N_("Mount all volumes with `boot' flag set."), 0, 0},
> +{"tries", 't', 0, N_("Max passphrase attempts."), 0, GRUB_KEY_ARG},
>  {0, 0, 0, 0, 0, 0}
>};
>
> @@ -807,6 +808,7 @@ grub_util_cryptodisk_get_uuid (grub_disk_t disk)
>
>  #endif
>
> +unsigned max_attempts;

Please move this before grub_cryptodisk_list definition.

>  static int check_boot, have_it;
>  static char *search_uuid;
>
> @@ -820,7 +822,7 @@ cryptodisk_close (grub_cryptodisk_t dev)
>  }
>
>  static grub_err_t
> -grub_cryptodisk_scan_device_real (const char *name, grub_disk_t source)
> +grub_cryptodisk_scan_device_real(const char *name, grub_disk_t source)

Please drop this change.

>  {
>grub_err_t err;
>grub_cryptodisk_t dev;
> @@ -933,7 +935,23 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int
> argc, char **args)
>
>if (argc < 1 && !state[1].set && !state[2].set)
>  return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
> -
> +

This looks strange. Could you fix it?

> +  /* Default to original behavior of 1 attempt */
> +  max_attempts = 1;
> +  if (state[3].set)
> +  {
> +  const char *max_attempts_str = state[3].arg;
> +  if (max_attempts_str)
> +  {
> +  char *end = NULL;
> +  long  tmpl = grub_strtol (max_attempts_str, &end, 10);
> +  if (tmpl > 0 && tmpl <= 256)

Why we need that limit? And I think that grub_strtoul() would be better here.

> +  {
> +  max_attempts = (unsigned) tmpl;
> +  }

You ca

Re: [PATCH v7 2/2] Add a module for retrieving SMBIOS information

2019-07-11 Thread Daniel Kiper
On Fri, Jul 05, 2019 at 08:47:09AM -0400, David Michael wrote:
> The following are two use cases from Rajat Jain :
>
> 1) We have a board that boots Linux and this board itself can be plugged into 
> one of different chassis types. We need to pass different parameters to the 
> kernel based on the "CHASSIS_TYPE" information that is passed by the bios in 
> the DMI / SMBIOS tables.
>
> 2) We may have a USB stick that can go into multiple boards, and the exact 
> kernel to be loaded depends on the machine information (PRODUCT_NAME etc) 
> passed via the DMI.
>
> Signed-off-by: David Michael 

Reviewed-by: Daniel Kiper 

There are some nitpicks but I fix them before committing.

Daniel

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


Re: [PATCH v7 1/2] Define SMBIOS3 entry point structures for EFI

2019-07-11 Thread Daniel Kiper
On Sat, Jul 06, 2019 at 12:17:11PM +0100, Leif Lindholm wrote:
> On Fri, Jul 05, 2019 at 08:47:02AM -0400, David Michael wrote:
> > This adds the GUID, and includes it in lsefisystab output.
> >
> > Signed-off-by: David Michael 
>
> Oh, and here we already have the SMBIOS 3.0 entry, splendid.
> Reviewed-by: Leif Lindholm 

Reviewed-by: Daniel Kiper 

> Daniel: please consider merging this one independently on 2/2, if that
> isn't going in straightaway.

I will take both. 2/2 is in quite good shape.

Daniel

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


Re: [PATCH 1/1] lsefisystab: support device tree

2019-07-11 Thread Daniel Kiper
On Sat, Jul 06, 2019 at 12:06:06PM +0100, Leif Lindholm wrote:
> On Sat, Jul 06, 2019 at 11:11:02AM +0200, Heinrich Schuchardt wrote:
> > The device tree may passed by the firmware as UEFI configuration table.
> >
> > Let lsefisystab display a short text and not only the GUID for the device
> > tree.
> >
> > Here is an example output:
> >
> > grub> lsefisystab
> > Address: 0xbff694d8
> > Signature: 5453595320494249 revision: 00020046
> > Vendor: Das U-Boot, Version=20190700
> > 2 tables:
> > 0xbe741000  eb9d2d31-2d88-11d3-9a160090273fc14d   SMBIOS
> > 0x87f0  b1b621d5-f19c-41a5-830bd9152c69aae0   DEVICE TREE
> >
> > Signed-off-by: Heinrich Schuchardt 
>
> Good idea!
> Reviewed-by: Leif Lindholm 

Reviewed-by: Daniel Kiper 

Daniel

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


Re: [PATCH] configure: Add -fno-ident when available

2019-07-11 Thread Vladimir 'phcoder' Serbinenko
From 03707a618d13a67f947833a7752c97ce3dda55a6 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko 
Date: Tue, 9 Jul 2019 17:46:25 +0200
Subject: [PATCH] configure: Add -fno-ident when available

With mingw for i386-pc without this option mingw generates a
rdata$zzz symbol that is page-aligned and hence lzma_decompress no
longer fits in its allocated space.
With mingw this also saves a bit of space in modules
With other compilers we already strip the relevant sections,
so no effect

Signed-off-by: Vladimir Serbinenko 
---
 configure.ac | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7656f2434..ce7760930 100644
--- a/configure.ac
+++ b/configure.ac
@@ -999,7 +999,18 @@ if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
   TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
 fi

+# Do not generate .ident sections
+AC_CACHE_CHECK([whether -fno-ident works], [grub_cv_cc_fno_ident], [
+  CFLAGS="$TARGET_CFLAGS -fno-ident"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+  [grub_cv_cc_fno_ident=yes],
+  [grub_cv_cc_fno_ident=no])
+])

+if test "x$grub_cv_cc_fno_ident" = xyes; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
+fi
+
 CFLAGS="$TARGET_CFLAGS"


-- 
2.11.0

On Thu, Jul 11, 2019 at 12:32 PM Daniel Kiper  wrote:
>
> On Tue, Jul 09, 2019 at 05:52:58PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> > On mingw i386-pc without this option mingw generates a
> > rdata$zzz symbol that is page-aligned and hence lzma_decompress no
> > longer fits in its allocated space.
>
> Out of curiosity, why is the size of lzma_decompress limited to an
> value? I thought that the total size of core.img is limited not
> lzma_decompress module.
>
> > With mingw this also saves a bit of space in modules
> > On other platforms we should already strip this, so no effect
>
> May I ask you to polish a comment a bit. And please add your SOB.
>
> > ---
> >  configure.ac | 23 +++
> >  1 file changed, 23 insertions(+)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 7656f2434..a86951b90 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -999,6 +999,29 @@ if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
> >TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
> >  fi
> >
> > +# Do not generate .ident sections
> > +AC_CACHE_CHECK([whether -fno-ident works], [grub_cv_cc_fno_ident], [
> > +  CFLAGS="$TARGET_CFLAGS -fno-ident"
> > +  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> > +  [grub_cv_cc_fno_ident=yes],
> > +  [grub_cv_cc_fno_ident=no])
> > +])
> > +
> > +if test "x$grub_cv_cc_fno_ident" = xyes; then
> > +  TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
> > +fi
>
> OK...
>
> > +
> > +AC_CACHE_CHECK([whether -fno-unwind-tables works],
> > [grub_cv_cc_fno_unwind_tables], [
> > +  CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
> > +  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> > +  [grub_cv_cc_fno_unwind_tables=yes],
> > +  [grub_cv_cc_fno_unwind_tables=no])
> > +])
> > +
> > +if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
> > +  TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
> > +fi
> > +
>
> ...but I am afraid that you copied this part from above by mistake.
> Could you drop that?
>
> Daniel



-- 
Regards
Vladimir 'phcoder' Serbinenko

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


Re: [PATCH] configure: Add -fno-ident when available

2019-07-11 Thread Vladimir 'phcoder' Serbinenko
On Thu, Jul 11, 2019 at 12:32 PM Daniel Kiper  wrote:
>
> On Tue, Jul 09, 2019 at 05:52:58PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> > On mingw i386-pc without this option mingw generates a
> > rdata$zzz symbol that is page-aligned and hence lzma_decompress no
> > longer fits in its allocated space.
>
> Out of curiosity, why is the size of lzma_decompress limited to an
> value? I thought that the total size of core.img is limited not
> lzma_decompress module.
>
It's not a module but a part of GRUB kernel, just compiled separately
because it's the only part of kernel that is not compressed. On
runtime it's loaded at 0x8200 and main GRUB kernel resides at 0x9000,
so decompressor can't be more that 0xe00. So far this was never a
problem except this case which turned out to be alignment issue and
it's good that we catched it since it wasted a lot of place in core
since this part is not compressed

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


Re: [PATCH] configure: disable arm movw/movt relocations for GCC

2019-07-11 Thread Vladimir 'phcoder' Serbinenko
LGTM

On Tue, 4 Jun 2019, 13:40 Leif Lindholm,  wrote:

> When building for arm, we already disable movw/movt relocations for clang,
> since they are incompatible with PE.
>
> When building with bare metal GCC toolchains (like the one used in the
> travis ci scripts), we end up with these relocations again. So add an
> additional test for the '-mword-relocations' flag used by GCC.
>
> Reported-by: Alexander Graf 
> Signed-off-by: Leif Lindholm 
> ---
>
> Note: unless this is added before the travis-ci set, the arm ci build
> will fail when enabled.
>
> ---
>
>  configure.ac | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 08b518fcc..e7725a546 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1198,7 +1198,8 @@ if test "x$target_cpu" = xarm; then
>AC_CACHE_CHECK([for options to disable movt and movw],
> grub_cv_target_cc_mno_movt, [
>  grub_cv_target_cc_mno_movt=no
>  for cand in "-mno-movt" \
> -   "-mllvm -arm-use-movt=0"; do
> +   "-mllvm -arm-use-movt=0" \
> +   "-mword-relocations"; do
>if test x"$grub_cv_target_cc_mno_movt" != xno ; then
>  break
>fi
> --
> 2.11.0
>
>
> ___
> 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: [PATCH] configure: Add -fno-ident when available

2019-07-11 Thread Daniel Kiper
On Thu, Jul 11, 2019 at 05:43:17PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> From 03707a618d13a67f947833a7752c97ce3dda55a6 Mon Sep 17 00:00:00 2001
> From: Vladimir Serbinenko 
> Date: Tue, 9 Jul 2019 17:46:25 +0200
> Subject: [PATCH] configure: Add -fno-ident when available
>
> With mingw for i386-pc without this option mingw generates a
> rdata$zzz symbol that is page-aligned and hence lzma_decompress no
> longer fits in its allocated space.
> With mingw this also saves a bit of space in modules
> With other compilers we already strip the relevant sections,
> so no effect
>
> Signed-off-by: Vladimir Serbinenko 

Reviewed-by: Daniel Kiper 

Daniel

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


Re: [PATCH v7] probe: Support probing for partition UUID with --part-uuid

2019-07-11 Thread Daniel Kiper
On Mon, May 20, 2019 at 02:11:00PM +0200, Daniel Kiper wrote:
> On Mon, May 20, 2019 at 01:45:59PM +0200, Paul Menzel wrote:
> > Dear Daniel,
> >
> > On 20.05.19 13:39, Daniel Kiper wrote:
> > > CC-ing Paul.
> > >
> > > On Wed, May 15, 2019 at 09:04:43PM +0200, Jacob Kroon wrote:
> > > > Linux supports root=PARTUUID= boot argument, so add
> > > > support for probing it. Compared to the fs UUID, the partition
> > > > UUID does not change when reformatting a partition.
> > > >
> > > > For now, only disks using a GPT partition table are supported.
> > > >
> > > > Signed-off-by: Jacob Kroon 
> > >
> > > Reviewed-by: Daniel Kiper 
> > >
> > > Paul, is your RB valid for v7?
> >
> > Yes, it is.
>
> Thanks.
>
> By the way, this is not a release material and it will be take into the
> tree after the release.

Pushed!

Daniel

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


Windows versions identification needs an update in osdect.cfg

2019-07-11 Thread Didier Spaier

Hello,

didier[/data/GitHub/grub]$ grep Windows docs/osdetect.cfg
menuentry "Windows Vista bootmgr (on $device)" $device {
menuentry "Windows NT/2000/XP loader (on $device)" $device {
menuentry "Windows 98/ME (on $device)" $device {

Could this file be updated for Windows 7,8,8.1,10?

If this is a wrong list for such a request, where should I post it?

Best,

Didier

 


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