* [PATCH] wistron_btns needs executable BIOS image
@ 2017-07-31 18:20 Jakub Bogusz
2019-01-25 19:14 ` [PATCH][RESEND] " Jakub Bogusz
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Bogusz @ 2017-07-31 18:20 UTC (permalink / raw)
To: linux-kernel, mitr
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
Hello,
This patch (originally agains 3.1x, now I updated include to build
against 4.12.x) fixes winstron_btns module issue with calling BIOS
functions in non-executable memory.
Tested (on Linux 3.10.x and few later versions) on F-S Amilo 8210 laptop.
--
Jakub Bogusz http://qboosh.pl/
[-- Attachment #2: linux-wistron-nx.patch --]
[-- Type: text/plain, Size: 1114 bytes --]
wistron_btns needs executable BIOS image.
Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
--- linux-4.12/drivers/input/misc/wistron_btns.c.orig 2013-11-16 09:05:55.612742472 +0100
+++ linux-4.12/drivers/input/misc/wistron_btns.c 2013-11-16 09:24:37.356028732 +0100
@@ -33,6 +33,7 @@
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
+#include <asm/set_memory.h>
/* How often we poll keys - msecs */
#define POLL_INTERVAL_DEFAULT 500 /* when idle */
@@ -124,6 +125,7 @@
if (entry_point >= 0xF0000) {
bios_code_map_base = base;
bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
+ set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
} else {
iounmap(base);
bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
@@ -134,6 +136,7 @@
goto err;
}
bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
+ set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
}
/* The Windows driver maps 0x10000 bytes, we keep only one page... */
bios_data_map_base = ioremap(0x400, 0xc00);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH][RESEND] wistron_btns needs executable BIOS image
2017-07-31 18:20 [PATCH] wistron_btns needs executable BIOS image Jakub Bogusz
@ 2019-01-25 19:14 ` Jakub Bogusz
2019-01-25 21:13 ` Eric Wong
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Bogusz @ 2019-01-25 19:14 UTC (permalink / raw)
To: linux-kernel, mitr
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
Let's try once again... (take 3)
First time I sent this patch when I prepared it in 2013 for Linux 3.12,
the second time after update for Linux 4.12 in 2017...
And it still applies to Linux 4.20.
Actual description in forwarded message.
--
Jakub Bogusz http://qboosh.pl/
[-- Attachment #2: Type: message/rfc822, Size: 2034 bytes --]
[-- Attachment #2.1.1: Type: text/plain, Size: 293 bytes --]
Hello,
This patch (originally agains 3.1x, now I updated include to build
against 4.12.x) fixes winstron_btns module issue with calling BIOS
functions in non-executable memory.
Tested (on Linux 3.10.x and few later versions) on F-S Amilo 8210 laptop.
--
Jakub Bogusz http://qboosh.pl/
[-- Attachment #2.1.2: linux-wistron-nx.patch --]
[-- Type: text/plain, Size: 1114 bytes --]
wistron_btns needs executable BIOS image.
Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
--- linux-4.12/drivers/input/misc/wistron_btns.c.orig 2013-11-16 09:05:55.612742472 +0100
+++ linux-4.12/drivers/input/misc/wistron_btns.c 2013-11-16 09:24:37.356028732 +0100
@@ -33,6 +33,7 @@
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
+#include <asm/set_memory.h>
/* How often we poll keys - msecs */
#define POLL_INTERVAL_DEFAULT 500 /* when idle */
@@ -124,6 +125,7 @@
if (entry_point >= 0xF0000) {
bios_code_map_base = base;
bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
+ set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
} else {
iounmap(base);
bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
@@ -134,6 +136,7 @@
goto err;
}
bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
+ set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
}
/* The Windows driver maps 0x10000 bytes, we keep only one page... */
bios_data_map_base = ioremap(0x400, 0xc00);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESEND] wistron_btns needs executable BIOS image
2019-01-25 19:14 ` [PATCH][RESEND] " Jakub Bogusz
@ 2019-01-25 21:13 ` Eric Wong
2019-01-25 21:41 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2019-01-25 21:13 UTC (permalink / raw)
To: Jakub Bogusz; +Cc: linux-kernel, mitr, Dmitry Torokhov, linux-input
Jakub Bogusz <qboosh@pld-linux.org> wrote:
> Let's try once again... (take 3)
>
> First time I sent this patch when I prepared it in 2013 for Linux 3.12,
> the second time after update for Linux 4.12 in 2017...
> And it still applies to Linux 4.20.
Adding Dmitry Torokhov and linux-input to Cc:
(that's what ./scripts/get_maintainer.pl says)
> Actual description in forwarded message.
>
>
> --
> Jakub Bogusz http://qboosh.pl/
> From: Jakub Bogusz <qboosh@pld-linux.org>
> To: linux-kernel@vger.kernel.org, mitr@volny.cz
> Subject: [PATCH] wistron_btns needs executable BIOS image
>
> Hello,
>
> This patch (originally agains 3.1x, now I updated include to build
> against 4.12.x) fixes winstron_btns module issue with calling BIOS
> functions in non-executable memory.
>
> Tested (on Linux 3.10.x and few later versions) on F-S Amilo 8210 laptop.
>
>
> --
> Jakub Bogusz http://qboosh.pl/
> wistron_btns needs executable BIOS image.
>
> Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
>
> --- linux-4.12/drivers/input/misc/wistron_btns.c.orig 2013-11-16 09:05:55.612742472 +0100
> +++ linux-4.12/drivers/input/misc/wistron_btns.c 2013-11-16 09:24:37.356028732 +0100
> @@ -33,6 +33,7 @@
> #include <linux/types.h>
> #include <linux/platform_device.h>
> #include <linux/leds.h>
> +#include <asm/set_memory.h>
>
> /* How often we poll keys - msecs */
> #define POLL_INTERVAL_DEFAULT 500 /* when idle */
> @@ -124,6 +125,7 @@
> if (entry_point >= 0xF0000) {
> bios_code_map_base = base;
> bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
> + set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
> } else {
> iounmap(base);
> bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
> @@ -134,6 +136,7 @@
> goto err;
> }
> bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
> + set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
> }
> /* The Windows driver maps 0x10000 bytes, we keep only one page... */
> bios_data_map_base = ioremap(0x400, 0xc00);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESEND] wistron_btns needs executable BIOS image
2019-01-25 21:13 ` Eric Wong
@ 2019-01-25 21:41 ` Dmitry Torokhov
2019-01-26 8:23 ` Jakub Bogusz
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2019-01-25 21:41 UTC (permalink / raw)
To: Eric Wong; +Cc: Jakub Bogusz, lkml, Miloslav Trmac, linux-input
On Fri, Jan 25, 2019 at 1:13 PM Eric Wong <e@80x24.org> wrote:
>
> Jakub Bogusz <qboosh@pld-linux.org> wrote:
> > Let's try once again... (take 3)
> >
> > First time I sent this patch when I prepared it in 2013 for Linux 3.12,
> > the second time after update for Linux 4.12 in 2017...
> > And it still applies to Linux 4.20.
>
> Adding Dmitry Torokhov and linux-input to Cc:
> (that's what ./scripts/get_maintainer.pl says)
>
> > Actual description in forwarded message.
> >
> >
> > --
> > Jakub Bogusz http://qboosh.pl/
>
> > From: Jakub Bogusz <qboosh@pld-linux.org>
> > To: linux-kernel@vger.kernel.org, mitr@volny.cz
> > Subject: [PATCH] wistron_btns needs executable BIOS image
> >
> > Hello,
> >
> > This patch (originally agains 3.1x, now I updated include to build
> > against 4.12.x) fixes winstron_btns module issue with calling BIOS
> > functions in non-executable memory.
> >
> > Tested (on Linux 3.10.x and few later versions) on F-S Amilo 8210 laptop.
> >
> >
> > --
> > Jakub Bogusz http://qboosh.pl/
>
> > wistron_btns needs executable BIOS image.
> >
> > Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
> >
> > --- linux-4.12/drivers/input/misc/wistron_btns.c.orig 2013-11-16 09:05:55.612742472 +0100
> > +++ linux-4.12/drivers/input/misc/wistron_btns.c 2013-11-16 09:24:37.356028732 +0100
> > @@ -33,6 +33,7 @@
> > #include <linux/types.h>
> > #include <linux/platform_device.h>
> > #include <linux/leds.h>
> > +#include <asm/set_memory.h>
> >
> > /* How often we poll keys - msecs */
> > #define POLL_INTERVAL_DEFAULT 500 /* when idle */
> > @@ -124,6 +125,7 @@
> > if (entry_point >= 0xF0000) {
> > bios_code_map_base = base;
> > bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
> > + set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
> > } else {
> > iounmap(base);
> > bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
> > @@ -134,6 +136,7 @@
> > goto err;
> > }
> > bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
> > + set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
> > }
> > /* The Windows driver maps 0x10000 bytes, we keep only one page... */
> > bios_data_map_base = ioremap(0x400, 0xc00);
It is really weird have __iomem region to have executable bit set. I
wonder if, along with the setting memory to X, we should not change
that ioremap() to memremap()?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESEND] wistron_btns needs executable BIOS image
2019-01-25 21:41 ` Dmitry Torokhov
@ 2019-01-26 8:23 ` Jakub Bogusz
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Bogusz @ 2019-01-26 8:23 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Eric Wong, lkml, Miloslav Trmac, linux-input
On Fri, Jan 25, 2019 at 01:41:47PM -0800, Dmitry Torokhov wrote:
> On Fri, Jan 25, 2019 at 1:13 PM Eric Wong <e@80x24.org> wrote:
> >
> > Jakub Bogusz <qboosh@pld-linux.org> wrote:
> > > Let's try once again... (take 3)
> > >
> > > First time I sent this patch when I prepared it in 2013 for Linux 3.12,
> > > the second time after update for Linux 4.12 in 2017...
> > > And it still applies to Linux 4.20.
> >
> > Adding Dmitry Torokhov and linux-input to Cc:
> > (that's what ./scripts/get_maintainer.pl says)
Thanks. I was aware only of MAINTAINERS file.
[...]
> > > wistron_btns needs executable BIOS image.
> > >
> > > Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
> > >
> > > --- linux-4.12/drivers/input/misc/wistron_btns.c.orig 2013-11-16 09:05:55.612742472 +0100
> > > +++ linux-4.12/drivers/input/misc/wistron_btns.c 2013-11-16 09:24:37.356028732 +0100
> > > @@ -33,6 +33,7 @@
> > > #include <linux/types.h>
> > > #include <linux/platform_device.h>
> > > #include <linux/leds.h>
> > > +#include <asm/set_memory.h>
> > >
> > > /* How often we poll keys - msecs */
> > > #define POLL_INTERVAL_DEFAULT 500 /* when idle */
> > > @@ -124,6 +125,7 @@
> > > if (entry_point >= 0xF0000) {
> > > bios_code_map_base = base;
> > > bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
> > > + set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
> > > } else {
> > > iounmap(base);
> > > bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
> > > @@ -134,6 +136,7 @@
> > > goto err;
> > > }
> > > bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
> > > + set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
> > > }
> > > /* The Windows driver maps 0x10000 bytes, we keep only one page... */
> > > bios_data_map_base = ioremap(0x400, 0xc00);
>
> It is really weird have __iomem region to have executable bit set. I
> wonder if, along with the setting memory to X, we should not change
> that ioremap() to memremap()?
Maybe... this is area of BIOS ROM, not I/O. But I'm not sure about
cacheability.
Looking at recent kernel code (4.19 to be exact) ioremap ends in
__ioremap_caller with _PAGE_CACHE_MODE_UC_MINUS, while memremap would end
in __ioremap_caller with e.g. (depending on flags) _PAGE_CACHE_MODE_WT.
Unfortunately now I have rare access to this hardware (FS Amilo) to
test.
--
Jakub Bogusz http://qboosh.pl/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-26 8:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-31 18:20 [PATCH] wistron_btns needs executable BIOS image Jakub Bogusz
2019-01-25 19:14 ` [PATCH][RESEND] " Jakub Bogusz
2019-01-25 21:13 ` Eric Wong
2019-01-25 21:41 ` Dmitry Torokhov
2019-01-26 8:23 ` Jakub Bogusz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.