Skip to contentSkip to conversation

Bug#891773: Related bug #871229 (but it didn't break my system))

DISCUSSION John Paul Adrian Glaubitz 1 participant 4 messages Mar 1, 2018 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 2977502.WqScPzveZc@bagend

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 2507110.GBoe0yDkvN@bagend

#4 lore raw

Adding GRUB upstream.

Quoted 2 lines · Diederik de Haas

#2 of_path_of_nvme (sys_devname=0x55973f55efd0 "/dev/nvme0n1", devnode=0x55973f55d950 "/dev/nvme0n", devicenode=0x55973f55df10 "nvme0n", device=<optimized out>)

     at ../../grub-core/osdep/linux/ofpath.c:388

It crashes in of_path_of_nvme() which Eric added in [1]. I need to find a machine with NVME here so I can debug it myself.

Sending GDB commands over mail will be a bit slow ...

Adrian

Quoted 1 line

[1] http://git.savannah.gnu.org/cgit/grub.git/commit/?id=2391d579094cfab65a0fd89a3c617cb3a33fb715

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#5 lore raw
Quoted 6 lines · John Paul Adrian Glaubitz
Quoted 2 lines · Diederik de Haas

#2  of_path_of_nvme (sys_devname=0x55973f55efd0 "/dev/nvme0n1", devnode=0x55973f55d950 "/dev/nvme0n", devicenode=0x55973f55df10 "nvme0n", device=<optimized out>) at ../../grub-core/osdep/linux/ofpath.c:388

It crashes in of_path_of_nvme() which Eric added in [1]. I need to find a machine with NVME here so I can debug it myself.

Found a machine with an NVME disk. It's an upstream bug and I can reproduce it with GRUB compiled from git master:

root@trlin:..glaubitz/grub> ./grub-probe --device /dev/nvme0n1 --target=hints_string Segmentation fault
root@trlin:..glaubitz/grub>

It only crashes when passing "--target=hints_string". Trying to debug it now.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#6 lore raw

Looking at the code in grub-core/osdep/linux/ofpath.c, the issue is most likely that the buffer that of_path is pointing to of_path_of_nvme() is not large enough to hold both the contents of *of_path and disk[MAX_DISK_CAT].

Let me test a patch.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#7 lore raw
Quoted 1 line · John Paul Adrian Glaubitz

Let me test a patch.

The problem is that of_path is empty here and the strcat tries to append "disk" to an empty buffer which fails.

This fixes it for me:

grub-core/osdep/linux/ofpath.c +6 -1
index 1c30e7233..da0000f0f 100644
@@ -389,8 +389,13 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
     }
 
   of_path = find_obppath (sysfs_path);
+
+  if(of_path)
+    strcat (of_path, disk);
+  else
+    of_path = strdup(disk);
+
   free (sysfs_path);
-  strcat (of_path, disk);
   return of_path;
 }
 

root@trlin:..glaubitz/grub> ./grub-probe --device /dev/nvme0n1 --target=hints_string --hint-ieee1275='ieee1275//disk@1'
root@trlin:..glaubitz/grub>

I'll send a patch upstream.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913