[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#844237: marked as done (Incorrect handling of device major/minor)

Your message dated Fri, 14 Apr 2017 15:18:55 +0000
with message-id <E1cz2zv-000BoN-HI@fasolo.debian.org>
and subject line Bug#844237: fixed in efivar 30-2
has caused the Debian Bug report #844237,
regarding Incorrect handling of device major/minor
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org

844237: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844237
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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 been
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, 'unstable')
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
diff -ru orig/efivar-30/src/linux.c efivar-30/src/linux.c
--- orig/efivar-30/src/linux.c	2016-10-03 18:29:32.000000000 +0200
+++ efivar-30/src/linux.c	2016-11-13 16:55:17.001150388 +0100
@@ -55,7 +55,7 @@
 	char *linkbuf;
 	ssize_t rc;
-	rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%hhu",
+	rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%"PRIu32,
 		      info->major, info->minor);
 	if (rc < 0)
 		return -1;
@@ -913,11 +913,11 @@
 		return 1;
 	if (S_ISBLK(buf.st_mode)) {
-		info->major = buf.st_rdev >> 8;
-		info->minor = buf.st_rdev & 0xFF;
+		info->major = major(buf.st_rdev);
+		info->minor = minor(buf.st_rdev);
 	} else if (S_ISREG(buf.st_mode)) {
-		info->major = buf.st_dev >> 8;
-		info->minor = buf.st_dev & 0xFF;
+		info->major = major(buf.st_dev);
+		info->minor = minor(buf.st_dev);
 	} else {
 		printf("Cannot stat non-block or non-regular file\n");
 		return 1;
diff -ru orig/efivar-30/src/linux.h efivar-30/src/linux.h
--- orig/efivar-30/src/linux.h	2016-10-03 18:29:32.000000000 +0200
+++ efivar-30/src/linux.h	2016-11-13 16:47:30.773353757 +0100
@@ -75,7 +75,7 @@
 	unsigned int disknum;
 	unsigned char part;
 	uint64_t major;
-	unsigned char minor;
+	uint32_t minor;
 	uint32_t edd10_devicenum;
 	struct pci_root_info pci_root;

Attachment: signature.asc
Description: Digital signature

--- End Message ---
--- Begin Message ---
Source: efivar
Source-Version: 30-2

We believe that the bug you reported is fixed in the latest version of
efivar, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 844237@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
Mario Limonciello <mario.limonciello@dell.com> (supplier of updated efivar package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)

Hash: SHA512

Format: 1.8
Date: Fri, 14 Apr 2017 09:43:21 -0500
Source: efivar
Binary: libefivar-dev libefiboot-dev efivar libefiboot1 libefivar1
Architecture: source amd64
Version: 30-2
Distribution: unstable
Urgency: medium
Maintainer: Debian UEFI Maintainers <debian-efi@lists.debian.org>
Changed-By: Mario Limonciello <mario.limonciello@dell.com>
 efivar     - Tools to manage UEFI variables
 libefiboot-dev - Development headers for libefiboot
 libefiboot1 - Library to manage UEFI variables
 libefivar-dev - Development headers for libefivar
 libefivar1 - Library to manage UEFI variables
Closes: 844237
 efivar (30-2) unstable; urgency=medium
   * Correct NEWS format to satisfy lintian warnings
   * Backport a patch to fix builds that fail from multiple definitions
   * Backport a patch from upstream to fix NVMe sysfs support after
     kernel 4.5
   * Backport patch from upsteram to fix major/minor device handling
     (Closes: #844237)
 064c73b35177bf3b2efad855fbaea67a94b2123c 2394 efivar_30-2.dsc
 0bbba2703f87978aafd5851a0e654b81e22a3c9d 8208 efivar_30-2.debian.tar.xz
 86bb9f4ff37697d0c30df3d8af09e7a8d964d18a 11818 efivar-dbgsym_30-2_amd64.deb
 59dfc8d529f71a999f7e41efd8a5a655dc2ad896 6374 efivar_30-2_amd64.buildinfo
 c0e6d2057fe5b8a48458d2877952c6c3d75e44b0 11652 efivar_30-2_amd64.deb
 f20d78efb0fdc108b0f8ea425b0c04c7da869461 6986 libefiboot-dev_30-2_amd64.deb
 9ea67be3f7b00f7ebc3c6426d87d3872db0f358f 62876 libefiboot1-dbgsym_30-2_amd64.deb
 00f4a36abd6bc38567795bc1b673b56998103d86 24650 libefiboot1_30-2_amd64.deb
 1cdd8a454d826a76775f7455fab88f1a685d466e 17960 libefivar-dev_30-2_amd64.deb
 f08c5d8081edb94f0bf6802f0080cbcd269b79e3 122404 libefivar1-dbgsym_30-2_amd64.deb
 3bfb7180745aabf065ae88a7a5f08142f19335c5 40820 libefivar1_30-2_amd64.deb
 f7261e0dab3b9859a08ff0a92b981ab09dc5cc0c5a954c1cd134e301889bc10c 2394 efivar_30-2.dsc
 2f8361d4b4008e7059783f7c227002282d4c8d3432d98bf8ee5530242ac1d16c 8208 efivar_30-2.debian.tar.xz
 f8ff47eb5222bed8690d39b9de95cfc7a6996ab36904cc747dd0c7b6815788a6 11818 efivar-dbgsym_30-2_amd64.deb
 2b02c0da2422fbc2303fe7f3c74b49eb60e8c8dedb58138e3e48216c60c34908 6374 efivar_30-2_amd64.buildinfo
 94cc32da9962adc1a7b90b0195d335e073938454ad50c9bf2b40fa4fa88a9337 11652 efivar_30-2_amd64.deb
 f6373c03457f8e67e2fd642e71086ea36b6ffc1d585168af29c9641aace35ddb 6986 libefiboot-dev_30-2_amd64.deb
 84a216c5a9216be3178799fcb734db9a198cb173ba89df58d326d524af48d039 62876 libefiboot1-dbgsym_30-2_amd64.deb
 b6066c1bc4f19040f941e78f0b699b4f4f1a62e636f02927b05dd85c16750746 24650 libefiboot1_30-2_amd64.deb
 8c401bd3f4c1ff2700544ebe5e03a120b8ccfee7604b5c2f03f871a6775cbd0f 17960 libefivar-dev_30-2_amd64.deb
 6b10ee11064f9d64044b3c5721498a960fd44513d59405f9bc59655f6b434920 122404 libefivar1-dbgsym_30-2_amd64.deb
 19007e694a0ca59c2feb60685e2a26fdd370d13205d3a4b1eaea8475737d7505 40820 libefivar1_30-2_amd64.deb
 4c5998fe9e4e5f4fd050d66b214a4dcd 2394 libs optional efivar_30-2.dsc
 4758caf040def720e449efbfd9d9f4f6 8208 libs optional efivar_30-2.debian.tar.xz
 da7253d1036e29e78085178c62f9490a 11818 debug extra efivar-dbgsym_30-2_amd64.deb
 fa1ca45d3c7a8e8f5fc4808d9e6af13a 6374 libs optional efivar_30-2_amd64.buildinfo
 495d3d8ed38b1a4fda04ffc8765672ad 11652 admin optional efivar_30-2_amd64.deb
 817f1b0add0e97da246338968bb0a133 6986 libdevel optional libefiboot-dev_30-2_amd64.deb
 e48939d1661fbaaf6d30c2a2059021fb 62876 debug extra libefiboot1-dbgsym_30-2_amd64.deb
 885b08b63d271a2b9154a9ef1c024e24 24650 libs optional libefiboot1_30-2_amd64.deb
 1d589a71b3a0f71632e6ecfbbd2584fe 17960 libdevel optional libefivar-dev_30-2_amd64.deb
 bdb8d0f628ab36044cd7d887f383bcb6 122404 debug extra libefivar1-dbgsym_30-2_amd64.deb
 0a2b7cdb374aa3893a78ecfae995bc00 40820 libs optional libefivar1_30-2_amd64.deb

Version: GnuPG v2


--- End Message ---

Reply to: