linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] title: no lookup_page for if statement
@ 2014-07-14 18:49 Nicholas Krause
  2014-07-14 18:59 ` Paul Bolle
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Krause @ 2014-07-14 18:49 UTC (permalink / raw)
  To: cmetcalf; +Cc: hannes, mhocko, akpm, zlu, linux-kernel

This patch removes the if define statement for page_lookup in order
to remove a fix me of this not being defined as of yet.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 0001-title-no-lookup_page-for-if-statement.patch | 37 ++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 0001-title-no-lookup_page-for-if-statement.patch

diff --git a/0001-title-no-lookup_page-for-if-statement.patch b/0001-title-no-lookup_page-for-if-statement.patch
new file mode 100644
index 0000000..f11c12e
--- /dev/null
+++ b/0001-title-no-lookup_page-for-if-statement.patch
@@ -0,0 +1,37 @@
+From 23c4afac6742d5df1d083ab6335a0a69f38c76b0 Mon Sep 17 00:00:00 2001
+From: Nicholas Krause <xerofoify@gmail.com>
+Date: Mon, 14 Jul 2014 14:39:02 -0400
+Subject: [PATCH] title: no lookup_page for if statement
+
+This patch removes the if define statement for page_lookup in order
+to remove a fix me of this not being defined as of yet.
+
+Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
+---
+ arch/tile/mm/fault.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
+index 6c05712..2297bf7 100644
+--- a/arch/tile/mm/fault.c
++++ b/arch/tile/mm/fault.c
+@@ -513,8 +513,6 @@ no_context:
+ 
+ 	bust_spinlocks(1);
+ 
+-	/* FIXME: no lookup_address() yet */
+-#ifdef SUPPORT_LOOKUP_ADDRESS
+ 	if (fault_num == INT_ITLB_MISS) {
+ 		pte_t *pte = lookup_address(address);
+ 
+@@ -523,7 +521,6 @@ no_context:
+ 			       " non-executable page - exploit attempt?"
+ 			       " (uid: %d)\n", current->uid);
+ 	}
+-#endif
+ 	if (address < PAGE_SIZE)
+ 		pr_alert("Unable to handle kernel NULL pointer dereference\n");
+ 	else
+-- 
+1.9.1
+
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] title: no lookup_page for if statement
  2014-07-14 18:49 [PATCH] title: no lookup_page for if statement Nicholas Krause
@ 2014-07-14 18:59 ` Paul Bolle
  2014-07-14 19:10   ` Nick Krause
  2014-07-14 19:35   ` Chris Metcalf
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Bolle @ 2014-07-14 18:59 UTC (permalink / raw)
  To: Nicholas Krause; +Cc: cmetcalf, hannes, mhocko, akpm, zlu, linux-kernel

On Mon, 2014-07-14 at 14:49 -0400, Nicholas Krause wrote:
> This patch removes the if define statement for page_lookup in order
> to remove a fix me of this not being defined as of yet.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  0001-title-no-lookup_page-for-if-statement.patch | 37 ++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 0001-title-no-lookup_page-for-if-statement.patch
> 
> diff --git a/0001-title-no-lookup_page-for-if-statement.patch b/0001-title-no-lookup_page-for-if-statement.patch
> new file mode 100644
> index 0000000..f11c12e
> --- /dev/null
> +++ b/0001-title-no-lookup_page-for-if-statement.patch
> @@ -0,0 +1,37 @@
> +From 23c4afac6742d5df1d083ab6335a0a69f38c76b0 Mon Sep 17 00:00:00 2001
> +From: Nicholas Krause <xerofoify@gmail.com>
> +Date: Mon, 14 Jul 2014 14:39:02 -0400
> +Subject: [PATCH] title: no lookup_page for if statement
> +
> +This patch removes the if define statement for page_lookup in order
> +to remove a fix me of this not being defined as of yet.
> +
> +Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> +---
> + arch/tile/mm/fault.c | 3 ---
> + 1 file changed, 3 deletions(-)
> +
> +diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
> +index 6c05712..2297bf7 100644
> +--- a/arch/tile/mm/fault.c
> ++++ b/arch/tile/mm/fault.c
> +@@ -513,8 +513,6 @@ no_context:
> + 
> + 	bust_spinlocks(1);
> + 
> +-	/* FIXME: no lookup_address() yet */
> +-#ifdef SUPPORT_LOOKUP_ADDRESS

Nicholas, stop! Just stop.

> + 	if (fault_num == INT_ITLB_MISS) {
> + 		pte_t *pte = lookup_address(address);
> + 
> +@@ -523,7 +521,6 @@ no_context:
> + 			       " non-executable page - exploit attempt?"
> + 			       " (uid: %d)\n", current->uid);
> + 	}
> +-#endif
> + 	if (address < PAGE_SIZE)
> + 		pr_alert("Unable to handle kernel NULL pointer dereference\n");
> + 	else
> +-- 
> +1.9.1
> +

For those not yet familiar with this train wreck, please do
    git grep SUPPORT_LOOKUP_ADDRESS


Paul Bolle


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] title: no lookup_page for if statement
  2014-07-14 18:59 ` Paul Bolle
@ 2014-07-14 19:10   ` Nick Krause
  2014-07-14 19:35   ` Chris Metcalf
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Krause @ 2014-07-14 19:10 UTC (permalink / raw)
  To: Paul Bolle
  Cc: Chris Metcalf, hannes, mhocko, Andrew Morton, zlu, linux-kernel

On Mon, Jul 14, 2014 at 2:59 PM, Paul Bolle <pebolle@tiscali.nl> wrote:
> On Mon, 2014-07-14 at 14:49 -0400, Nicholas Krause wrote:
>> This patch removes the if define statement for page_lookup in order
>> to remove a fix me of this not being defined as of yet.
>>
>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>> ---
>>  0001-title-no-lookup_page-for-if-statement.patch | 37 ++++++++++++++++++++++++
>>  1 file changed, 37 insertions(+)
>>  create mode 100644 0001-title-no-lookup_page-for-if-statement.patch
>>
>> diff --git a/0001-title-no-lookup_page-for-if-statement.patch b/0001-title-no-lookup_page-for-if-statement.patch
>> new file mode 100644
>> index 0000000..f11c12e
>> --- /dev/null
>> +++ b/0001-title-no-lookup_page-for-if-statement.patch
>> @@ -0,0 +1,37 @@
>> +From 23c4afac6742d5df1d083ab6335a0a69f38c76b0 Mon Sep 17 00:00:00 2001
>> +From: Nicholas Krause <xerofoify@gmail.com>
>> +Date: Mon, 14 Jul 2014 14:39:02 -0400
>> +Subject: [PATCH] title: no lookup_page for if statement
>> +
>> +This patch removes the if define statement for page_lookup in order
>> +to remove a fix me of this not being defined as of yet.
>> +
>> +Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>> +---
>> + arch/tile/mm/fault.c | 3 ---
>> + 1 file changed, 3 deletions(-)
>> +
>> +diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
>> +index 6c05712..2297bf7 100644
>> +--- a/arch/tile/mm/fault.c
>> ++++ b/arch/tile/mm/fault.c
>> +@@ -513,8 +513,6 @@ no_context:
>> +
>> +     bust_spinlocks(1);
>> +
>> +-    /* FIXME: no lookup_address() yet */
>> +-#ifdef SUPPORT_LOOKUP_ADDRESS
>
> Nicholas, stop! Just stop.
>
>> +     if (fault_num == INT_ITLB_MISS) {
>> +             pte_t *pte = lookup_address(address);
>> +
>> +@@ -523,7 +521,6 @@ no_context:
>> +                            " non-executable page - exploit attempt?"
>> +                            " (uid: %d)\n", current->uid);
>> +     }
>> +-#endif
>> +     if (address < PAGE_SIZE)
>> +             pr_alert("Unable to handle kernel NULL pointer dereference\n");
>> +     else
>> +--
>> +1.9.1
>> +
>
> For those not yet familiar with this train wreck, please do
>     git grep SUPPORT_LOOKUP_ADDRESS
>
>
> Paul Bolle
>

Very well , I will not work on this any longer as I seem to be just
screwing it up.
Cheers Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] title: no lookup_page for if statement
  2014-07-14 18:59 ` Paul Bolle
  2014-07-14 19:10   ` Nick Krause
@ 2014-07-14 19:35   ` Chris Metcalf
  2014-07-17  0:50     ` Nick Krause
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Metcalf @ 2014-07-14 19:35 UTC (permalink / raw)
  To: Paul Bolle, Nicholas Krause; +Cc: hannes, mhocko, akpm, zlu, linux-kernel

On 7/14/2014 2:59 PM, Paul Bolle wrote:
> On Mon, 2014-07-14 at 14:49 -0400, Nicholas Krause wrote:
>> >This patch removes the if define statement for page_lookup in order
>> >to remove a fix me of this not being defined as of yet.
>> >
>> >Signed-off-by: Nicholas Krause<xerofoify@gmail.com>

Nicholas, you can't just enable this code; it will break the
build, since there is no lookup_address() symbol on tile.

I'd like to encourage you to look for more substantive kinds of
changes to submit to LKML.  This one and the last one (adding some
underscores to some obsolete symbols) both have ended up costing me
some time to look at and figure out what's actually going on, but
for no real value.  I suspect there may be "janitor" tasks that
are more useful if you are looking for small starting points
(Google for "linux kernel janitors").

That said I'm going to go ahead and check in the following change
which actually does work, now that my attention has been drawn here.

diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index 6c0571216a9d..7e884001ca6a 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -513,17 +513,14 @@ no_context:

         bust_spinlocks(1);

-       /* FIXME: no lookup_address() yet */
-#ifdef SUPPORT_LOOKUP_ADDRESS
-       if (fault_num == INT_ITLB_MISS) {
-               pte_t *pte = lookup_address(address);
+       if (fault_num == INT_ITLB_MISS && address >= PAGE_OFFSET) {
+               pte_t *pte = virt_to_kpte(address);

-               if (pte && pte_present(*pte) && !pte_exec_kernel(*pte))
-                       pr_crit("kernel tried to execute"
-                              " non-executable page - exploit attempt?"
-                              " (uid: %d)\n", current->uid);
+               if (pte && pte_present(*pte) && !pte_exec(*pte))
+                       pr_crit("kernel tried to execute non-executable page"
+                               " - exploit attempt? (uid: %d)\n",
+                               from_kuid(&init_user_ns, current_uid()));
         }
-#endif
         if (address < PAGE_SIZE)
                 pr_alert("Unable to handle kernel NULL pointer dereference\n");
         else

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] title: no lookup_page for if statement
  2014-07-14 19:35   ` Chris Metcalf
@ 2014-07-17  0:50     ` Nick Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Krause @ 2014-07-17  0:50 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Paul Bolle, Johannes Weiner, mhocko, Andrew Morton, zlu, linux-kernel

On Mon, Jul 14, 2014 at 3:35 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
> On 7/14/2014 2:59 PM, Paul Bolle wrote:
>>
>> On Mon, 2014-07-14 at 14:49 -0400, Nicholas Krause wrote:
>>>
>>> >This patch removes the if define statement for page_lookup in order
>>> >to remove a fix me of this not being defined as of yet.
>>> >
>>> >Signed-off-by: Nicholas Krause<xerofoify@gmail.com>
>
>
> Nicholas, you can't just enable this code; it will break the
> build, since there is no lookup_address() symbol on tile.
>
> I'd like to encourage you to look for more substantive kinds of
> changes to submit to LKML.  This one and the last one (adding some
> underscores to some obsolete symbols) both have ended up costing me
> some time to look at and figure out what's actually going on, but
> for no real value.  I suspect there may be "janitor" tasks that
> are more useful if you are looking for small starting points
> (Google for "linux kernel janitors").
>
> That said I'm going to go ahead and check in the following change
> which actually does work, now that my attention has been drawn here.
>
> diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
> index 6c0571216a9d..7e884001ca6a 100644
> --- a/arch/tile/mm/fault.c
> +++ b/arch/tile/mm/fault.c
> @@ -513,17 +513,14 @@ no_context:
>
>         bust_spinlocks(1);
>
> -       /* FIXME: no lookup_address() yet */
> -#ifdef SUPPORT_LOOKUP_ADDRESS
> -       if (fault_num == INT_ITLB_MISS) {
> -               pte_t *pte = lookup_address(address);
> +       if (fault_num == INT_ITLB_MISS && address >= PAGE_OFFSET) {
> +               pte_t *pte = virt_to_kpte(address);
>
> -               if (pte && pte_present(*pte) && !pte_exec_kernel(*pte))
> -                       pr_crit("kernel tried to execute"
> -                              " non-executable page - exploit attempt?"
> -                              " (uid: %d)\n", current->uid);
> +               if (pte && pte_present(*pte) && !pte_exec(*pte))
> +                       pr_crit("kernel tried to execute non-executable
> page"
> +                               " - exploit attempt? (uid: %d)\n",
> +                               from_kuid(&init_user_ns, current_uid()));
>         }
> -#endif
>         if (address < PAGE_SIZE)
>                 pr_alert("Unable to handle kernel NULL pointer
> dereference\n");
>         else
>
> --
> Chris Metcalf, Tilera Corp.
> http://www.tilera.com
>
Chris,
Understood I screwed up here. I am doing other changes with build and
warning errors. Plus some
fix me issues that are simple. I will double check my patches and the
code they are relating to more
carefully. I should have asked you before writing this patch:(.
Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-17  0:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 18:49 [PATCH] title: no lookup_page for if statement Nicholas Krause
2014-07-14 18:59 ` Paul Bolle
2014-07-14 19:10   ` Nick Krause
2014-07-14 19:35   ` Chris Metcalf
2014-07-17  0:50     ` Nick Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).