Re: Q: a bogus set_fs(USER_DS) in setup_frame/setup_rt_frame ?

From: Linus Torvalds
Date: Tue Jul 17 2007 - 12:07:40 EST




On Tue, 17 Jul 2007, Oleg Nesterov wrote:
>
> I am really puzzled by set_fs(USER_DS) in setup_frame/setup_rt_frame.
>
> How is it possible that current->addr_limit != USER_DS ? If this _is_
> possible, how can can we trust the result of access_ok() above?

Heh. I think it's entirely historical.

Please realize that the whole reason that function is called "set_fs()" is
that it literally used to set the %fs segment register, not
"->addr_limit".

So I think the "set_fs(USER_DS)" is there _only_ to match the other

regs->xds = __USER_DS;
regs->xes = __USER_DS;
regs->xss = __USER_DS;
regs->xcs = __USER_CS;

things, and never mattered. And now it matters even less, and has been
copied to all other architectures where it is just totally insane.

Linus
-
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/