diff options
-rw-r--r-- | main/linux-rpi/APKBUILD | 34 | ||||
-rw-r--r-- | main/linux-rpi/aslr-pie.patch | 64 | ||||
-rw-r--r-- | main/linux-rpi/config-rpi.armhf | 11 | ||||
-rw-r--r-- | main/linux-rpi/config-rpi2.armhf | 11 |
4 files changed, 81 insertions, 39 deletions
diff --git a/main/linux-rpi/APKBUILD b/main/linux-rpi/APKBUILD index a5fc81bfe9..d74002c85e 100644 --- a/main/linux-rpi/APKBUILD +++ b/main/linux-rpi/APKBUILD @@ -2,7 +2,7 @@ _mainflavor=rpi pkgname=linux-$_mainflavor -pkgver=3.18.12 +pkgver=3.18.16 case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=${pkgver};; @@ -16,7 +16,7 @@ options="!strip" install= source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz - http://dev.alpinelinux.org/~tteras/linux-3.18.y-rpi-20150420.patch + http://dev.alpinelinux.org/~tteras/linux-3.18.y-rpi-20150617.patch aslr-pie.patch config-rpi.armhf @@ -200,23 +200,23 @@ dev() { } md5sums="9e854df51ca3fef8bfe566dbd7b89241 linux-3.18.tar.xz -84d1fb9f072df226e920f6a0a3e7d10a patch-3.18.12.xz -5b6f84850feedc7d6f84120f693f751d linux-3.18.y-rpi-20150420.patch -f901100a661ec62aac12000872d0276c aslr-pie.patch -6a62fbc4673397b2bdec224fa545e3d6 config-rpi.armhf -364f132269304e5effd94473e4012488 config-rpi2.armhf +96aeccef48037aee98911634664af68e patch-3.18.16.xz +4224a13261d65db5c09e88e6a14d670b linux-3.18.y-rpi-20150617.patch +6f5854b710be8f38f67fc7ec8f3d0625 aslr-pie.patch +1363c986e464d95a090c9e30fa2b5253 config-rpi.armhf +895a0286802f8dc0eeecd2d31443074d config-rpi2.armhf 1f3dda659442fa7e2afc62bffeceb129 markdt" sha256sums="becc413cc9e6d7f5cc52a3ce66d65c3725bc1d1cc1001f4ce6c32b69eb188cbd linux-3.18.tar.xz -53245c0a5b172575867afe88c91fc46468ae06ed7bf4fa6d2150072e27f7209e patch-3.18.12.xz -9ffda4b8cf2f144de565c7b38fd37ab72ec463c82d972f7bc7aea221810c2ef6 linux-3.18.y-rpi-20150420.patch -07e9b089c0d5d57e91256ff6e8fe373519c8bd4ae4cba4eb4a2edad3e2cc9a8e aslr-pie.patch -69c075126c8de0ceb07d1f3669958cd8df02a9963304615059ec455b6bd92253 config-rpi.armhf -36ab7dd794a66e4fc743b6b2d45f94424ba748a62be5b5d8fbe11a0aa158cfbd config-rpi2.armhf +f60602c8de2ae7b1507c538b6af65d5b933727a06f56075898ff64fdcf650313 patch-3.18.16.xz +82f881bfbb3f761ae4c81ec6272ee0b62f1066deb9fff9b290774f844d838638 linux-3.18.y-rpi-20150617.patch +e1db8126b13507f4442b1fa5c3d2648fa453f0ca3ea75145ec6f0faeab923c08 aslr-pie.patch +d4d77d5b9defb84add2f77e045c39ba4a067f7fdd908d13be0e7b6b18caf00c4 config-rpi.armhf +927ec7509b059fc8f4f4220f917571c68404c15683724e0090e3669417e32fd3 config-rpi2.armhf 289a7509bc294295b65680c7fff0b2ec07cf359ea8a57cef00267396885f9b54 markdt" sha512sums="2f0b72466e9bc538a675738aa416573d41bbbd7e3e2ffd5b5b127afde609ebc278cec5a3c37e73479607e957c13f1b4ed9782a3795e0dcc2cf8e550228594009 linux-3.18.tar.xz -285322919b8638d821414bb494709008710ac55c0bc33d477b28013d51e9791a8487e9671cfdaaf0fa937fab119f40180c4577caac95263d1bb0c6e821069908 patch-3.18.12.xz -c55434312a1ee155f424a1df9ec049ce92319a4ff84ab42d806748a24131c8a17c522a51fa4d227c1abee804c39ecddb32e552f88a71e04350ca9c67b9ed9f53 linux-3.18.y-rpi-20150420.patch -35055eea7fce660a200cf6f56490a88f1601b4ea95d2364191ad0d890633e8811f2753b5816dad9640384a764b147a4a80b95f39e3bd7a66a15fd5b3ec0c794a aslr-pie.patch -ab0209e5ab5a050fd44f2b7b628bac6b94ef9e3ce6f171c147f4b90b67c7dbddc029fd84a35130108b9fb669453190b252818df53dd253bcf29c647ce7c34ef7 config-rpi.armhf -5d489ff5d362b09f263ed52b3081a254d47835738f985bbcf6c09ebdbd06428410d344a493cce1d42693560dba03ed58d473ba856dce679dc8412a403d7645c2 config-rpi2.armhf +868de9793e67e741dc69d61339f66c25d08d36a7d67b09d5644e855e05faf239c1e6e01299812a68edc52a39e132d7ec459929cb5d8a0936fe6aa580a72af80c patch-3.18.16.xz +f48822399d842f60d533d11be0c1eeb881d21fb69fa110d19cb0778d271e9f2bd230673a9dffca98483a317150fac62c0eb1e0fae50d85751b05fa0b7a58132f linux-3.18.y-rpi-20150617.patch +8b2080b72cd0a1bf8f528e8a7a4ab7921ee9e1e425a5c0439e9409b599eca23ad992f5fec67924da736c20de9728c7f0cb2f3087212a278e82ba8ecfc8fac7d0 aslr-pie.patch +35a51b1fb94605cc522a76389be940f9283361fe4062de3fd0439f87e1b2fdc8852de3e7c93b0657641577f266697cfe7e953b3ec5d82e45f45ba7901b2d0e74 config-rpi.armhf +98943cedaa265f0e7a1b45ba12ee6bcc5118841b2ae1789036e475da640f2d3fa65e871cd8e184a1acdc3120bda98001de92682cdbaaaad737de7da4a50b9632 config-rpi2.armhf 89601aa0e4f77fb07fb1d58c6a9394c8683bc7dfc905ca6612d607ef4188637662d295fa3d5640e3e0a4cd08c98c10511a4f3cea41e7568167b12d0a6c813e8b markdt" diff --git a/main/linux-rpi/aslr-pie.patch b/main/linux-rpi/aslr-pie.patch index a31dba42a8..70771427db 100644 --- a/main/linux-rpi/aslr-pie.patch +++ b/main/linux-rpi/aslr-pie.patch @@ -1,6 +1,39 @@ ---- linux-3.11/fs/binfmt_elf.c.orig -+++ linux-3.11/fs/binfmt_elf.c -@@ -802,21 +802,19 @@ +From 0b277f076ead47454b4438a7d20d0807acd2af6a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Tue, 1 Oct 2013 13:46:04 +0300 +Subject: [PATCH] fs/binfmt_elf: fix memory map for PIE applications +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +arch/x86/include/asm/elf.h comment says: +" +ELF_ET_DYN_BASE is the location that an ET_DYN program is loaded +if exec'ed. Typical use of this is to invoke "./ld.so someprog" +to test out a new version of the loader. We need to make sure +that it is out of the way of the program that it will "exec", +and that there is sufficient room for the brk. +" + +In case we have main application linked as PIE, this will cause +problems as the main program itself will go the memory location +that allows very little heap. + +This fixes the loader to detect PIE application by checking if +elf_interpreter is requested, and loads them to beginning of the +address space instead of the specially crafted place for elf +interpreter. + +Signed-off-by: Timo Teräs <timo.teras@iki.fi> +--- + fs/binfmt_elf.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c +index 78f4608..c075ace 100644 +--- a/fs/binfmt_elf.c ++++ b/fs/binfmt_elf.c +@@ -801,6 +801,10 @@ static int load_elf_binary(struct linux_binprm *bprm) * default mmap base, as well as whatever program they * might try to exec. This is because the brk will * follow the loader, and is not movable. */ @@ -11,20 +44,27 @@ #ifdef CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE /* Memory randomization might have been switched off * in runtime via sysctl or explicit setting of - * personality flags. -- * If that is the case, retain the original non-zero -- * load_bias value in order to establish proper -- * non-randomized mappings. +@@ -809,13 +813,14 @@ static int load_elf_binary(struct linux_binprm *bprm) + * load_bias value in order to establish proper + * non-randomized mappings. */ - if (current->flags & PF_RANDOMIZE) +- if (current->flags & PF_RANDOMIZE) - load_bias = 0; - else - load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); -#else - load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); -+ load_bias += (get_random_int() & STACK_RND_MASK) << PAGE_SHIFT; ++ if (current->flags & PF_RANDOMIZE) { ++ if (elf_interpreter) ++ load_bias += (get_random_int() & STACK_RND_MASK) << PAGE_SHIFT; ++ else ++ load_bias = 0; ++ } #endif + load_bias = ELF_PAGESTART(load_bias - vaddr); - } - - error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, + total_size = total_mapping_size(elf_phdata, + loc->elf_ex.e_phnum); + if (!total_size) { +-- +2.4.0 + diff --git a/main/linux-rpi/config-rpi.armhf b/main/linux-rpi/config-rpi.armhf index 5b131255d6..4fce1a1c34 100644 --- a/main/linux-rpi/config-rpi.armhf +++ b/main/linux-rpi/config-rpi.armhf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.18.11 Kernel Configuration +# Linux/arm 3.18.16 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -3258,15 +3258,16 @@ CONFIG_MMC_BLOCK_BOUNCE=y # # MMC/SD/SDIO Host Controller Drivers # +CONFIG_MMC_BCM2835=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y # CONFIG_MMC_ARMMMCI is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y # CONFIG_MMC_SDHCI_OF_ARASAN is not set # CONFIG_MMC_SDHCI_PXAV3 is not set # CONFIG_MMC_SDHCI_PXAV2 is not set -CONFIG_MMC_BCM2835=y -CONFIG_MMC_BCM2835_DMA=y -CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 CONFIG_MMC_SPI=m # CONFIG_MMC_DW is not set # CONFIG_MMC_VUB300 is not set @@ -3427,7 +3428,7 @@ CONFIG_DMA_BCM2708=y # CONFIG_FSL_EDMA is not set # CONFIG_NBPFAXI_DMA is not set CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=m +CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DMA_OF=y # diff --git a/main/linux-rpi/config-rpi2.armhf b/main/linux-rpi/config-rpi2.armhf index 81c7085576..1d436a9d69 100644 --- a/main/linux-rpi/config-rpi2.armhf +++ b/main/linux-rpi/config-rpi2.armhf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.18.11 Kernel Configuration +# Linux/arm 3.18.16 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -3298,15 +3298,16 @@ CONFIG_MMC_BLOCK_BOUNCE=y # # MMC/SD/SDIO Host Controller Drivers # +CONFIG_MMC_BCM2835=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y # CONFIG_MMC_ARMMMCI is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y # CONFIG_MMC_SDHCI_OF_ARASAN is not set # CONFIG_MMC_SDHCI_PXAV3 is not set # CONFIG_MMC_SDHCI_PXAV2 is not set -CONFIG_MMC_BCM2835=y -CONFIG_MMC_BCM2835_DMA=y -CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 CONFIG_MMC_SPI=m # CONFIG_MMC_DW is not set # CONFIG_MMC_VUB300 is not set @@ -3467,7 +3468,7 @@ CONFIG_DMA_BCM2708=y # CONFIG_FSL_EDMA is not set # CONFIG_NBPFAXI_DMA is not set CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=m +CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DMA_OF=y # |