Bug#844237: Incorrect handling of device major/minor
Thanks for reporting this issue. Since it's an upstream issue I've filed it here:
We'll track to see what upstream decides to do for the issue.
> -----Original Message-----
> From: Nicolas George [mailto:email@example.com]
> Sent: Sunday, November 13, 2016 8:36 AM
> To: Debian Bug Tracking System <firstname.lastname@example.org>
> Subject: Bug#844237: Incorrect handling of device major/minor
> Package: libefivar1
> Version: 30-1
> Severity: important
> Tags: upstream patch
> Part of the code in linux.c uses "st_rdev >> 8" and "st_rdev & 0xFF" to find
> the major and minor device number for the disk to install. It was correct a
> long time ago but it has been quite some time that both major and minor can
> exceed 8 bits. The libc provides macros to extract the major and minor;
> another part of the same file uses these macros. Furthermore, the field
> containing the minor is declared as unsigned char, making it 8 bits.
> The result is a failure to prepare boot variables, making grub-install fail
> for example, for a device with a minor >= 256. The device I needed to use
> was 179:256. Running with strace showed an attempt to access
> /sys/dev/block/4275:0 instead of /sys/dev/block/179:256 that would have
> correct considering the previous system call was fstat() showing
> "st_rdev=makedev(179, 256)". You can notice that 179+256*16 = 4275.
> The attached patch fixes things.
> Nicolas George
> -- System Information:
> Debian Release: stretch/sid
> APT prefers stable-updates
> APT policy: (500, 'stable-updates'), (500, 'testing'), (500, 'stable'), (50,
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
> Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
> Locale: LANG=, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> Versions of packages libefivar1:amd64 depends on:
> ii libc6 2.24-5
> libefivar1:amd64 recommends no packages.
> libefivar1:amd64 suggests no packages.
> -- no debconf information