Re: [RFC] [PATCH] make add_taint() inline

From: Kyle Moffett
Date: Sun Sep 11 2005 - 18:11:24 EST


On Sep 11, 2005, at 18:56:37, Randy.Dunlap wrote:
On Sun, 11 Sep 2005 14:22:08 -0400 Kyle Moffett wrote:

On Sep 11, 2005, at 13:44:37, donate wrote:

From: Randy Dunlap <rdunlap@xxxxxxxxxxxx>

add_taint() is a trivial function.
No need to call it out-of-line, just make it inline and
remove its export.

Actually, in this case it might be better to leave add_taint
exported, add and export a new function get_taint(), and then
remove all export of the variable "tainted". I've actually
seen one case where some module removed taint bits. I don't

some in-tree module?

No, it was a BSD out-of-tree module, I don't even remember what
it was anymore, it's probably not significant, but if "tainted"
is exported, it seems like some binary module writers might get
the brilliant idea to twiddle it by hand. How about something
like this to enforce the idea that taintedness is add-only:

void add_taint(unsigned int flags);
unsigned int get_taint(void);

static unsigned int tainted;

Then use atomic bit operations on platforms which have them and
a spinlock on those that don't. My guess where the lack of
locking might cause issues is if we hit an MCE and bad_page at
the same time on SMP or something. It seems like it would be
really rare in practice, but I guess that appropriately timed
badness in multiple drivers (perhaps one triggered by the other?)
could cause it to occur.

Maybe Dave Jones's modprobe/insmod killer test on a big
multiprocessor system could do that one day.

Or that :-D. The only way I can see this dying or accidentally
untainting is if two processors try to add different types of
taint simultaneously.

Cheers,
Kyle Moffett

--
Somone asked me why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

"Why do musicians compose symphonies and poets write poems? They do it because
life wouldn't have any meaning for them if they didn't. That's why I draw
cartoons. It's my life."
-- Charles Shultz


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/