From 31d76fc0f5b63ad0abd4b25fc8d0b56e071f9e4cc9953e00d0da702f73b59b55 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 28 Aug 2018 08:13:38 +0000 Subject: [PATCH] Accepting request 631907 from home:michael-chang:bsc:1105163 - Fix overflow in sector count calculation (bsc#1105163) * grub2-msdos-fix-overflow.patch OBS-URL: https://build.opensuse.org/request/show/631907 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=312 --- grub2-msdos-fix-overflow.patch | 46 ++++++++++++++++++++++++++++++++++ grub2.changes | 6 +++++ grub2.spec | 2 ++ 3 files changed, 54 insertions(+) create mode 100644 grub2-msdos-fix-overflow.patch diff --git a/grub2-msdos-fix-overflow.patch b/grub2-msdos-fix-overflow.patch new file mode 100644 index 0000000..886150f --- /dev/null +++ b/grub2-msdos-fix-overflow.patch @@ -0,0 +1,46 @@ +Index: grub-2.02/grub-core/partmap/msdos.c +=================================================================== +--- grub-2.02.orig/grub-core/partmap/msdos.c ++++ grub-2.02/grub-core/partmap/msdos.c +@@ -175,9 +175,9 @@ grub_partition_msdos_iterate (grub_disk_ + e = mbr.entries + p.index; + + p.start = p.offset +- + (grub_le_to_cpu32 (e->start) ++ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) - delta; +- p.len = grub_le_to_cpu32 (e->length) ++ p.len = (grub_uint64_t)grub_le_to_cpu32 (e->length) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); + p.msdostype = e->type; + +@@ -217,7 +217,7 @@ grub_partition_msdos_iterate (grub_disk_ + if (grub_msdos_partition_is_extended (e->type)) + { + p.offset = ext_offset +- + (grub_le_to_cpu32 (e->start) ++ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); + if (! ext_offset) + ext_offset = p.offset; +@@ -301,9 +301,9 @@ pc_partition_map_embed (struct grub_disk + + if (!grub_msdos_partition_is_empty (e->type) + && end > offset +- + (grub_le_to_cpu32 (e->start) ++ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS))) +- end = offset + (grub_le_to_cpu32 (e->start) ++ end = offset + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); + + /* If this is a GPT partition, this MBR is just a dummy. */ +@@ -319,7 +319,7 @@ pc_partition_map_embed (struct grub_disk + if (grub_msdos_partition_is_extended (e->type)) + { + offset = ext_offset +- + (grub_le_to_cpu32 (e->start) ++ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) + << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); + if (! ext_offset) + ext_offset = offset; diff --git a/grub2.changes b/grub2.changes index 148b6c2..ae1175b 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Aug 23 08:37:15 UTC 2018 - mchang@suse.com + +- Fix overflow in sector count calculation (bsc#1105163) + * grub2-msdos-fix-overflow.patch + ------------------------------------------------------------------- Thu Aug 9 02:48:18 UTC 2018 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index dba605b..38a07a5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -220,6 +220,7 @@ Patch87: 0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch Patch88: unix-exec-avoid-atexit-handlers-when-child-exits.patch Patch89: 0001-xfs-Accept-filesystem-with-sparse-inodes.patch Patch90: grub2-binutils2.31.patch +Patch91: grub2-msdos-fix-overflow.patch # Btrfs snapshot booting related patches Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch Patch102: grub2-btrfs-02-export-subvolume-envvars.patch @@ -515,6 +516,7 @@ swap partition while in resuming %patch88 -p1 %patch89 -p1 %patch90 -p1 +%patch91 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1