lkml.org 
[lkml]   [2011]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/3 V13] RO/NX protection for loadable kernel
Xiaotian Feng a écrit :
> On Thu, Dec 23, 2010 at 5:35 AM, <Valdis.Kletnieks@vt.edu> wrote:
>> On Wed, 22 Dec 2010 13:40:19 +0100, Ingo Molnar said:
>>> * mat <castet.matthieu@free.fr> wrote:
>>>
>>>> Le Wed, 8 Dec 2010 14:19:51 -0800,
>>>> Kees Cook <kees.cook@canonical.com> a écrit :
>>>>
>>>>> On Fri, Nov 26, 2010 at 06:23:55PM +0100, mat wrote:
>>>>>> could you try the attached patch ?
>>>>>>
>>>>>> on module load, we sort the __jump_table section. So we should make
>>>>>> it writable.
>>>>>>
>>>>>>
>>>>>> Matthieu
>>>>>> diff --git a/arch/x86/include/asm/jump_label.h
>>>>>> b/arch/x86/include/asm/jump_label.h index f52d42e..574dbc2 100644
>>>>>> --- a/arch/x86/include/asm/jump_label.h
>>>>>> +++ b/arch/x86/include/asm/jump_label.h
>>>>>> @@ -14,7 +14,7 @@
>>>>>> do
>>>>>> { \ asm
>>>>>> goto("1:" \
>>>>>> JUMP_LABEL_INITIAL_NOP \
>>>>>> - ".pushsection __jump_table, \"a\" \n\t"\
>>>>>> + ".pushsection __jump_table, \"aw\" \n\t"\
>>>>>> _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
>>>>>> ".popsection \n\t" \
>>>>>> : : "i" (key) : : label);
>>>>>> \
>>>>> Acked-by: Kees Cook <kees.cook@canonical.com>
>>>>>
>>>>> Can this please get committed to tip?
>>>> I think it is not need anymore with Steven Rostedt patch [1]
>>>>
>>>> Matthieu
>>>>
>>>> [1]
>>>>>> Here we set the text read only before we call the notifiers. The
>>>>>> function tracer changes the calls to mcount into nops via a notifier
>>>>>> call so this must be done after the module notifiers.
>>> What's the status of this bug?
>>>
>>> If we still need the patch then please submit it standalone with a proper subject
>>> line, with acks/signoffs added, etc.
>> Steve Rostedt's patch that moves the setting of the page permissions seems to
>> make this patch no longer necessary. I tripped over this same issue, but the
>> version in the latest -mmotm does not need it, as it includes Steve's fix.
>>
>
> I'm facing a boot failure (panic'ed on remove_jump_label_module_init)
> on 2.6.37 (latest commit 3c0cb7c), which is 100% reproducible.
> With this patch applied, I can boot my machine successfully, so I do
> think this patch is needed.
>
Could you confirm that this patch fix the problem ?


Matthieu
From 0eeba453aaba0ebff86f0a7ad9bfb8afbde0c0dc Mon Sep 17 00:00:00 2001
From: Matthieu CASTET <castet.matthieu@free.fr>
Date: Thu, 20 Jan 2011 21:25:03 +0100
Subject: [PATCH] Fix jump table in module init section

If we use jump table in module init, there are marked
as removed in __jump_table section after init is done.

But we already applied ro permissions on the module, so
we can't modify a read only section (crash in
remove_jump_label_module_init).

Make the __jump_table section rw.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
---
arch/x86/include/asm/jump_label.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index f52d42e..574dbc2 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -14,7 +14,7 @@
do { \
asm goto("1:" \
JUMP_LABEL_INITIAL_NOP \
- ".pushsection __jump_table, \"a\" \n\t"\
+ ".pushsection __jump_table, \"aw\" \n\t"\
_ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
".popsection \n\t" \
: : "i" (key) : : label); \
--
1.7.2.3
\
 
 \ /
  Last update: 2011-01-20 21:35    [W:0.122 / U:4.644 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site