lkml.org 
[lkml]   [2008]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Make taint bit reliable
On Mon, 1 Sep 2008 18:46:32 +0200
Andi Kleen <andi@firstfloor.org> wrote:

> Make taint bit reliable
>
> It's somewhat unlikely that it happens, but right now a race window
> between interrupts or machine checks or oopses could corrupt the tainted
> bitmap because it is modified in a non atomic fashion.
>
> Convert the taint variable to an unsigned long and use only atomic bit
> operations on it.
>
> Unfortunately this means the intvec sysctl functions cannot be used on
> it anymore.
>
> It turned out the taint sysctl handler could actually be simplified
> a bit (since it only increases capabilities) so this patch actually
> removes code.
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
>
> ---
> include/linux/kernel.h | 2 -
> kernel/panic.c | 5 ++-
> kernel/sysctl.c | 67 +++++++++++++++++++++----------------------------
> 3 files changed, 33 insertions(+), 41 deletions(-)

You missed one:

./arch/x86/kernel/smpboot.c: tainted &= ~TAINT_UNSAFE_SMP;


To prevent reoccurrences we could/should rename `tainted' to something else.

Also, it would end up with a beter result if we were to change

- #define TAINT_PROPRIETARY_MODULE (1<<0)
- #define TAINT_FORCED_MODULE (1<<1)
...
+ #define TAINT_PROPRIETARY_MODULE 0
+ #define TAINT_FORCED_MODULE 1
...


and remove that ungainly log2() you had to add, and just prevent all
open-coded access to the 'tainted' global. ie: add `int get_taint(void)'?



\
 
 \ /
  Last update: 2008-09-03 02:47    [W:0.038 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site