diff --git a/blkid-fix-invalid-pointer-cast-in-DumpDisk.patch b/blkid-fix-invalid-pointer-cast-in-DumpDisk.patch new file mode 100644 index 0000000..a9e7b89 --- /dev/null +++ b/blkid-fix-invalid-pointer-cast-in-DumpDisk.patch @@ -0,0 +1,42 @@ +From 34e18b247876eb9b42417ca2702b047f29670fca Mon Sep 17 00:00:00 2001 +From: Benjamin Gilbert +Date: Tue, 11 Aug 2020 08:11:58 -0400 +Subject: [PATCH] blkid: fix invalid pointer cast in DumpDisk() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +LogicalSectorSize is a Go int (64 bits on 64-bit systems) and the +argument to blkid_get_logical_sector_size() is a C int * (pointer to +32 bits). The value fits in 32 bits and the field is initialized to +zero, so we get away with this on little-endian systems, but not on +s390x. + +See also 76a71f08d3c1. + +Reported-by: Jakub Čajka +--- + internal/exec/util/blkid.go | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/internal/exec/util/blkid.go b/internal/exec/util/blkid.go +index 8e53e26c..3888ce54 100644 +--- a/internal/exec/util/blkid.go ++++ b/internal/exec/util/blkid.go +@@ -147,10 +147,11 @@ func DumpDisk(device string) (DiskInfo, error) { + cDevice := C.CString(device) + defer C.free(unsafe.Pointer(cDevice)) + +- cSectorSizeRef := (*C.int)(unsafe.Pointer(&output.LogicalSectorSize)) +- if err := cResultToErr(C.blkid_get_logical_sector_size(cDevice, cSectorSizeRef), device); err != nil { ++ var sectorSize C.int ++ if err := cResultToErr(C.blkid_get_logical_sector_size(cDevice, §orSize), device); err != nil { + return DiskInfo{}, err + } ++ output.LogicalSectorSize = int(sectorSize) + + numParts := C.int(0) + cNumPartsRef := (*C.int)(unsafe.Pointer(&numParts)) +-- +2.25.4 + diff --git a/ignition.spec b/ignition.spec index 477d06a..520c55c 100644 --- a/ignition.spec +++ b/ignition.spec @@ -61,11 +61,14 @@ Name: ignition Version: 2.6.0 -Release: 1.git%{shortcommit}%{?dist} +Release: 2.git%{shortcommit}%{?dist} Summary: First boot installer and configuration tool License: ASL 2.0 URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz +# Fix sector size detection on s390x +# https://github.com/coreos/ignition/pull/1070 +Patch0: blkid-fix-invalid-pointer-cast-in-DumpDisk.patch %define gopath %{_datadir}/gocode ExcludeArch: ppc64 @@ -429,6 +432,7 @@ Ignition project's Github releases page. # setup command reference: http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html # unpack source0 and apply patches %setup -T -b 0 -q -n %{repo}-%{commit} +%patch0 -p1 %build # Set up PWD as a proper import path for go @@ -588,6 +592,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %endif %changelog +* Wed Aug 12 2020 Benjamin Gilbert - 2.6.0-2.git947598e +- Fix sector size detection on s390x + * Fri Aug 07 2020 Benjamin Gilbert - 2.6.0-1.git947598e - New release