Accepting request 591814 from Base:System

OBS-URL: https://build.opensuse.org/request/show/591814
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=179
This commit is contained in:
Dominique Leuenberger 2018-03-30 10:01:00 +00:00 committed by Git OBS Bridge
parent 206157bd2d
commit b99bc51d5e
3 changed files with 51 additions and 3 deletions

View File

@ -0,0 +1,40 @@
From: Masahiro Matsuya <mmatsuya@redhat.com>
The netmask configured in firmware is not respected on ppc64 (big endian).
When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath().
/vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512
The netmask in this bootpath is no problem, since it's a value specified in firmware. But,
The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22).
As a result, 16 was used for netmask wrongly.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4)
And, the count of zero with __builtin_ctz can be 16.
This patch changes it as below.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit)
---
grub-core/net/drivers/ieee1275/ofnet.c | 2 +-
1 file changed, 1 insertion(+), 2 deletions(-)
diff -ur grub-2.02~/grub-core/net/drivers/ieee1275/ofnet.c grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c
--- grub-2.02~/grub-core/net/drivers/ieee1275/ofnet.c 2018-03-26 13:49:55.399558334 +0200
+++ grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c 2018-03-26 13:51:03.092656921 +0200
@@ -232,7 +232,7 @@
}
grub_net_add_ipv4_local (inter,
- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
+ __builtin_clz (~ (subnet_mask.ipv4)));
}
if (gateway_addr.ipv4 != 0)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 26 11:37:13 UTC 2018 - msuchanek@suse.com
- Fix incorrect netmask on ppc64 (bsc#1085419)
* grub2-Fix-incorrect-netmask-on-ppc64.patch
-------------------------------------------------------------------
Mon Mar 12 07:31:10 UTC 2018 - mchang@suse.com

View File

@ -213,8 +213,7 @@ Patch81: grub2-lvm-allocate-metadata-buffer-from-raw-contents.patch
Patch82: grub2-diskfilter-support-pv-without-metadatacopies.patch
Patch83: grub2-efi-uga-64bit-fb.patch
Patch84: grub2-s390x-09-improve-zipl-setup.patch
Patch85: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Patch86: grub2-getroot-scan-disk-pv.patch
Patch85: grub2-getroot-scan-disk-pv.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
@ -247,6 +246,8 @@ Patch234: fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-
Patch235: 0002-Add-Virtual-LAN-support.patch
Patch236: grub2-efi_gop-avoid-low-resolution.patch
Patch277: grub2-ppc64-cas-reboot-support.patch
Patch278: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Patch279: grub2-Fix-incorrect-netmask-on-ppc64.patch
# Support HTTP Boot IPv4 and IPv6 (fate#320129)
Patch280: 0001-misc-fix-invalid-character-recongition-in-strto-l.patch
Patch281: 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
@ -492,7 +493,6 @@ swap partition while in resuming
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
@ -519,6 +519,8 @@ swap partition while in resuming
%patch235 -p1
%patch236 -p1
%patch277 -p1
%patch278 -p1
%patch279 -p1
%patch280 -p1
%patch281 -p1
%patch282 -p1