summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksim Fomin2018-08-25 20:05:54 +0100
committerMaksim Fomin2018-08-25 20:05:54 +0100
commitaaf472d005b9a0919519e4c6a8e505d12f331a16 (patch)
tree6ce62f65d0ee821351460c481a8310ae7649b6a0
parent4e8f885f08c502bb05fd97d3644558dca81eb0af (diff)
downloadaur-aaf472d005b9a0919519e4c6a8e505d12f331a16.tar.gz
Add xfs and relocation patch
-rw-r--r--.SRCINFO6
-rw-r--r--0009-xfs-Accept-filesystem-with-sparse-inodes.patch60
-rw-r--r--0010-relocation.patch65
-rw-r--r--PKGBUILD12
4 files changed, 141 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 4a727d323ceb..589cea0815e8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = grub-luks-keyfile
pkgdesc = GNU GRand Unified Bootloader (2) with crypto extensions to support for DMCrypt and LUKS volumes with detached headers and key files.
pkgver = 2.02
- pkgrel = 6
+ pkgrel = 7
epoch = 2
url = https://www.gnu.org/software/grub/
install = grub.install
@@ -67,6 +67,8 @@ pkgbase = grub-luks-keyfile
source = http://grub.johnlane.ie/assets/0004-Cryptomount-support-plain-dm-crypt.patch
source = http://grub.johnlane.ie/assets/0005-Cryptomount-support-for-hyphens-in-UUID.patch
source = 0006-Cryptomount-support-for-using-whole-device-as-keyfile.patch::https://github.com/johnlane/grub/pull/8.patch
+ source = 0009-xfs-Accept-filesystem-with-sparse-inodes.patch
+ source = 0010-relocation.patch
source = grub.default
source = grub.cfg
validpgpkeys = E53D497F3FA42AD8C9B4D1E835A93B74E82E4209
@@ -88,6 +90,8 @@ pkgbase = grub-luks-keyfile
sha256sums = e47409d04f740a71360775af25c53662386a49ea7f93ada39ed636b9ae8a0a22
sha256sums = 7b9ff45ba6e6c1ad45e6984580393e3801ef86144e48dbe5fe97d4aa8b90706e
sha256sums = 2c312e4e46fc3b5a215771fb9bfb328079d588ac59751e980cecaed06f7f5c76
+ sha256sums = fcd5a626d4af33665d041ce42df813f1f198d8230ea186481b155a5b676f3b87
+ sha256sums = 51562fa1016c54567dbf42a86c0cfc902372ab579bbee17879a81aff09b76b99
sha256sums = 74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82
sha256sums = c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad
diff --git a/0009-xfs-Accept-filesystem-with-sparse-inodes.patch b/0009-xfs-Accept-filesystem-with-sparse-inodes.patch
new file mode 100644
index 000000000000..6c6a750b42f0
--- /dev/null
+++ b/0009-xfs-Accept-filesystem-with-sparse-inodes.patch
@@ -0,0 +1,60 @@
+From cda0a857dd7a27cd5d621747464bfe71e8727fff Mon Sep 17 00:00:00 2001
+From: Daniel Kiper <daniel.kiper@oracle.com>
+Date: Tue, 29 May 2018 16:16:02 +0200
+Subject: xfs: Accept filesystem with sparse inodes
+
+The sparse inode metadata format became a mkfs.xfs default in
+xfsprogs-4.16.0, and such filesystems are now rejected by grub as
+containing an incompatible feature.
+
+In essence, this feature allows xfs to allocate inodes into fragmented
+freespace. (Without this feature, if xfs could not allocate contiguous
+space for 64 new inodes, inode creation would fail.)
+
+In practice, the disk format change is restricted to the inode btree,
+which as far as I can tell is not used by grub. If all you're doing
+today is parsing a directory, reading an inode number, and converting
+that inode number to a disk location, then ignoring this feature
+should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED
+
+I did some brief testing of this patch by hacking up the regression
+tests to completely fragment freespace on the test xfs filesystem, and
+then write a large-ish number of inodes to consume any existing
+contiguous 64-inode chunk. This way any files the grub tests add and
+traverse would be in such a fragmented inode allocation. Tests passed,
+but I'm not sure how to cleanly integrate that into the test harness.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+Tested-by: Chris Murphy <lists@colorremedies.com>
+---
+ grub-core/fs/xfs.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
+index c6031bd..3b00c74 100644
+--- a/grub-core/fs/xfs.c
++++ b/grub-core/fs/xfs.c
+@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+");
+ #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */
+ #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */
+
+-/* We do not currently verify metadata UUID so it is safe to read such filesystem */
++/*
++ * Directory entries with ftype are explicitly handled by GRUB code.
++ *
++ * We do not currently read the inode btrees, so it is safe to read filesystems
++ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature.
++ *
++ * We do not currently verify metadata UUID, so it is safe to read filesystems
++ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature.
++ */
+ #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \
+ (XFS_SB_FEAT_INCOMPAT_FTYPE | \
++ XFS_SB_FEAT_INCOMPAT_SPINODES | \
+ XFS_SB_FEAT_INCOMPAT_META_UUID)
+
+ struct grub_xfs_sblock
+--
+cgit v1.0-41-gc330
+
diff --git a/0010-relocation.patch b/0010-relocation.patch
new file mode 100644
index 000000000000..1aeae68493f7
--- /dev/null
+++ b/0010-relocation.patch
@@ -0,0 +1,65 @@
+commit 842c390469e2c2e10b5aa36700324cd3bde25875
+Author: H.J. Lu <hjl.tools@gmail.com>
+Date: Sat Feb 17 06:47:28 2018 -0800
+
+ x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
+
+ Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
+
+ https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
+
+ x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
+ 32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as
+ R_X86_64_PC32.
+
+ Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+ Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+
+diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
+index e49d0b6ff..18facf47f 100644
+--- a/grub-core/efiemu/i386/loadcore64.c
++++ b/grub-core/efiemu/i386/loadcore64.c
+@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
+ break;
+
+ case R_X86_64_PC32:
++ case R_X86_64_PLT32:
+ err = grub_efiemu_write_value (addr,
+ *addr32 + rel->r_addend
+ + sym.off
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 440690673..3a73e6e6c 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
+ break;
+
+ case R_X86_64_PC32:
++ case R_X86_64_PLT32:
+ {
+ grub_int64_t value;
+ value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
+diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
+index a2bb05439..39d7efb91 100644
+--- a/util/grub-mkimagexx.c
++++ b/util/grub-mkimagexx.c
+@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
+ break;
+
+ case R_X86_64_PC32:
++ case R_X86_64_PLT32:
+ {
+ grub_uint32_t *t32 = (grub_uint32_t *) target;
+ *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
+diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
+index 9179285a5..a79271f66 100644
+--- a/util/grub-module-verifier.c
++++ b/util/grub-module-verifier.c
+@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
+ -1
+ }, (int[]){
+ R_X86_64_PC32,
++ R_X86_64_PLT32,
+ -1
+ }
+ },
diff --git a/PKGBUILD b/PKGBUILD
index 1af980055b9c..bda62830b772 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -24,7 +24,7 @@ _pkgname="grub"
pkgname="grub-luks-keyfile"
pkgdesc="GNU GRand Unified Bootloader (2) with crypto extensions to support for DMCrypt and LUKS volumes with detached headers and key files."
pkgver=2.02
-pkgrel=6
+pkgrel=7
epoch=2
url="https://www.gnu.org/software/grub/"
arch=('x86_64')
@@ -74,6 +74,8 @@ source=("https://ftp.gnu.org/gnu/${_pkgname}/${_pkgname}-${pkgver}.tar.xz"{,.sig
'http://grub.johnlane.ie/assets/0004-Cryptomount-support-plain-dm-crypt.patch'
'http://grub.johnlane.ie/assets/0005-Cryptomount-support-for-hyphens-in-UUID.patch'
'0006-Cryptomount-support-for-using-whole-device-as-keyfile.patch::https://github.com/johnlane/grub/pull/8.patch'
+ '0009-xfs-Accept-filesystem-with-sparse-inodes.patch'
+ '0010-relocation.patch'
'grub.default'
'grub.cfg')
@@ -94,6 +96,8 @@ sha256sums=('810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f'
'e47409d04f740a71360775af25c53662386a49ea7f93ada39ed636b9ae8a0a22'
'7b9ff45ba6e6c1ad45e6984580393e3801ef86144e48dbe5fe97d4aa8b90706e'
'2c312e4e46fc3b5a215771fb9bfb328079d588ac59751e980cecaed06f7f5c76'
+ 'fcd5a626d4af33665d041ce42df813f1f198d8230ea186481b155a5b676f3b87'
+ '51562fa1016c54567dbf42a86c0cfc902372ab579bbee17879a81aff09b76b99'
'74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82'
'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
@@ -132,6 +136,12 @@ prepare() {
patch -Np1 -i "${srcdir}/0006-Cryptomount-support-for-using-whole-device-as-keyfile.patch"
echo
+ msg "Patch xfs: Accept filesystem with sparse inodes"
+ patch -Np1 -i "${srcdir}/0009-xfs-Accept-filesystem-with-sparse-inodes.patch"
+
+ msg "Patch x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32"
+ patch -Np1 -i "${srcdir}/0010-relocation.patch"
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme"
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"