Subject: Re: [PATCH 3/3 V13] RO/NX protection for loadable kernel

From: matthieu castet <[email-masked]>
Date: Sat, 8 Jan 2011 12:24:55 +0100

Le Fri, 7 Jan 2011 14:04:26 +0100,
Ingo Molnar <[email-masked]> a écrit :

> 
> * Xiaotian Feng <[email-masked]> wrote:
> 
> > 
> > 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.
> 
> That would be commit:
> 
>  94462ad3b147: module: Move RO/NX module protection to after ftrace
> module update
> 
> So if commit 3c0cb7c is still broken, it has 94462ad3b147 included
> already, and there's some other bug. Kees, Steve, any ideas?
> 
The problem comes from remove_jump_label_module_init that does :
if (within_module_init(iter->code, mod))
                        iter->key = 0;

This mean if there are jump label in the module init, we will
invalidate them by writing the the jump label section.

But this section is read only.

The solution is either to make the section read write, either we avoid
this write.

For avoid the write a solution could be to do something like
trim_init_extable :
/*
 * If the exception table is sorted, any referring to the module init
 * will be at the beginning or the end.
 */

Matthieu