Subject: [alpine-devel] [PATCH] linux-grsec: fix bus error with i810 graphics

From: Isaac Dunham <[email-masked]>
Date: Sat, 7 Jun 2014 07:39:28 -0700

I just recently installed Alpine 3.0 on an old computer with 256 MB RAM,
800 MHz PIII CPU, and i810 graphics; it's hooked up to a 1280x1024
monitor, so vesa sucks.
When I installed xf86-video-intel, X died from a bus error.
This seems to be a known problem with Linux 3.14; the included patch
(found online) fixed it for me.

Please add this; it takes several hours to build a kernel on that
computer.
The patch may need adjustment, though; patch applied it with fuzz=2.

Thanks,
Isaac Dunham.
>From 504d7ace56339f4869681b6dc540abc500837265 Mon Sep 17 00:00:00 2001
From: Isaac Dunham <[email-masked]>
Date: Sat, 7 Jun 2014 07:15:56 -0700
Subject: [PATCH] This is needed to get more than a bus error from i810
 graphics.

---
 main/linux-grsec/APKBUILD       |  4 ++++
 main/linux-grsec/i810-gpu.patch | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 main/linux-grsec/i810-gpu.patch

diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index 6d3afc8..0b80f77 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -21,6 +21,7 @@ source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz
 
 	fix-memory-map-for-PIE-applications.patch
 	imx6q-no-unclocked-sleep.patch
+	i810-gpu.patch
 
 	kernelconfig.x86
 	kernelconfig.x86_64
@@ -169,6 +170,7 @@ a56bf05cb9033097198f9269bbcff130  patch-3.14.5.xz
 e3879ccdca92dbec4e42109a9f5552bb  grsecurity-3.0-3.14.5-201406021708.patch
 c6a4ae7e8ca6159e1631545515805216  fix-memory-map-for-PIE-applications.patch
 1a307fc1d63231bf01d22493a4f14378  imx6q-no-unclocked-sleep.patch
+d0dad4e3b7c78df23bec61b2b55f975a  i810-gpu.patch
 7dbab6689abe6d34178c40773ea6759d  kernelconfig.x86
 21240113d77342def57ea9d6017c2cd6  kernelconfig.x86_64
 727688e12e37262437fc9ca9c1fbd215  kernelconfig.armhf"
@@ -177,6 +179,7 @@ ecc00856830c05736b3f99609bc6d80353c29d2db9b0dffb91eb2d169808cac4  patch-3.14.5.x
 8695054d1a1bd02acd2a08b1268eb65349f6877b1be1a00251dcbc5dd95a5a00  grsecurity-3.0-3.14.5-201406021708.patch
 500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7  fix-memory-map-for-PIE-applications.patch
 21179fbb22a5b74af0a609350ae1a170e232908572b201d02e791d2ce0a685d3  imx6q-no-unclocked-sleep.patch
+be64122f8e619c9f5315ff522c1e82112a40213aab2d980490889d81eeabee65  i810-gpu.patch
 ea60441bed9d50ed3cde8b73c664448b4efebd60c6b58ea0a6df67f087bbc64b  kernelconfig.x86
 c87d9045758f474d092e18a77fc936c1fc9007b09564b79a1ecc46c083c7e3c0  kernelconfig.x86_64
 00fc74f27931d161ecc1c26e5cd000d9aeaf6ebea6e0e1293ecde14a64d80467  kernelconfig.armhf"
@@ -185,6 +188,7 @@ sha512sums="5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55
 86aa2f621e4fe52eaf498236289b66532f7a8bc087e9100ec168861cead44b7a4329ad609314b6b0bcbf114adf7378ae4eb38b37fc7d8e414473b7de1b84bd2f  grsecurity-3.0-3.14.5-201406021708.patch
 4665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7  fix-memory-map-for-PIE-applications.patch
 87d1ad59732f265a5b0db54490dc1762c14ea4b868e7eb1aedc3ce57b48046de7bbc08cf5cfcf6f1380fa84063b0edb16ba3d5e3c5670be9bbb229275c88b221  imx6q-no-unclocked-sleep.patch
+73338dfda508a99975e0570edf8e5278f48978caf4a1772df2b8a3b861212f61ee99dd6774730ef21d6b1b6d05b953648382746a55ad50519b3dd4c6d49b2fb7  i810-gpu.patch
 e19c081066d5615f3037d66e8cf5074bfa4d448d8db2f32642957eb808e8c26e2a2467d333f8773a02aac44b13d5afe556780bd2303df3a9ac88ad6099a898b2  kernelconfig.x86
 79f7c6890808b9e1f23332c5697e20c5c22e5a12e0e83f697626c96e0fbf7e22b96ed06ffbf398aac716bb0d02e012f7dd5c51bf501d7a1831110c8d0872f1cd  kernelconfig.x86_64
 84cf8bf558d3fa98a46a2dc1bdd5ddbe4b36b210282d939a47123d889a47240469e7b37f1351854a396c58f4366b8267e1e7990fb91be23bc8ddd9f2a33a6257  kernelconfig.armhf"
diff --git a/main/linux-grsec/i810-gpu.patch b/main/linux-grsec/i810-gpu.patch
new file mode 100644
index 0000000..6caf73a
--- /dev/null
+++ b/main/linux-grsec/i810-gpu.patch
@@ -0,0 +1,16 @@
+Tobias Powalowski found this fixed i810 gfx.
+
+--- a/fs/kernfs/file.c
++++ b/fs/kernfs/file.c
+@@ -475,7 +475,10 @@
+ 	goto out_unlock;
+ 
+ 	ops = kernfs_ops(of->kn);
++	if (ops->mmap)
++		rc = ops->mmap(of, vma);
++	if (rc)
++		goto out_put;
+-	rc = ops->mmap(of, vma);
+ 
+  	/*
+ 	 * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup()
-- 
2.0.0

---

From: Natanael Copa <[email-masked]>
Date: Mon, 9 Jun 2014 09:59:36 +0200

On Sat, 7 Jun 2014 07:39:28 -0700

> The patch may need adjustment, though; patch applied it with fuzz=2.

nice! thanks!

Do you have any reference to upstream commit?

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Mon, 9 Jun 2014 10:40:17 +0200

On Mon, 9 Jun 2014 09:59:36 +0200

> Do you have any reference to upstream commit?

I found it:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/fs/kernfs/file.c?h=linux-3.14.y&id=59516f324f324b6b392b94833da3972e346c5f0c

I think it will come with 3.14.6 so maybe we just wait for that? (likely tomorrow)

-nc

---

---

From: Isaac Dunham <[email-masked]>
Date: Thu, 12 Jun 2014 21:29:03 -0700

> I think it will come with 3.14.6 so maybe we just wait for that? (likely tomorrow)

Looking at kernel.org, 3.14.7 is the kernel.org version that came out
yesterday, and the version that includes the fix.
grsec 3.14.6 does not include this, AFAICT.

Thanks,
Isaac Dunham

---

---

From: Timo Teras <[email-masked]>
Date: Fri, 13 Jun 2014 08:06:37 +0300

On Thu, 12 Jun 2014 21:29:03 -0700

> grsec 3.14.6 does not include this, AFAICT.

Git says 3.14.6 has it. So does the changelogs. So the current 3.14.6
should work.

But yes, update to 3.14.7 is coming too...

/Timo

---

---

From: Isaac Dunham <[email-masked]>
Date: Mon, 9 Jun 2014 06:40:35 -0700

> Do you have any reference to upstream commit?
I just checked and it corresponds to
b44b2140265 kernfs: add back missing error check in kernfs_fop_mmap()
in Linus' tree.
That version doesn't add back the
if (ops->mmap)
because it's supposed to bail before then under that condition.

Thanks,
Isaac Dunham

---