Re: + fully-honor-vdso_enabled.patch added to -mm tree

From: Oleg Nesterov
Date: Fri Mar 02 2007 - 17:19:25 EST


On 03/02, John Reiser wrote:
>
> Oleg Nesterov wrote:
> > John Reiser wrote:
>
> >>+ switch (vdso_enabled) {
> >>+ case 0: /* none */
> >>+ return 0;
> >
> >
> > This means we don't initialize mm->context.vdso and ->sysenter_return.
> >
> > Is it ok? For example, setup_rt_frame() uses VDSO_SYM(&__kernel_rt_sigreturn),
> > sysenter_past_esp pushes ->sysenter_return on stack.
>
> Paul Mundt has commented on setup_rt_frame() and provided a patch which
> bullet-proofs that area. I will include that patch into the next revision.

Confused. I still think his patch incomplete. Don't we need the same check
in setup_rt_frame() ?

> The value of ->sysenter_return is interpreted in user space by the
> sysexit instruction; nobody else cares what the value is. The kernel
> is not required to provide a good value when vdso_enabled is zero,

Yes sure.

> Both context.vdso and sysenter_return could be set to zero whenever
> vdso_enabled is zero; those two values might even be defaulted.
> I'll add such a change to the next revision of the patch, if you'll
> defend it against claims of "unnecessary code."

context.vdso == NULL after mm_alloc(). I don't see a "good" arch dependent
function to clear ->sysenter_return (if we really need this). May be
flush_thread().

> > Note also that load_elf_binary does
> >
> > arch_setup_additional_pages()
> > create_elf_tables()
> >
> > , looks like application can crash after exec if vdso_enabled changes from 0
> > to 1 in between.
>
> Correct. Changing vdso_enabled from 0 to non-zero must be prepared
> to lose this race if it is not prevented. Ordinarily it won't matter
> because the administrator will perform such changes at a "quiet" time.

I agree, this problem is mostly theoretical, but I believe it is hardly
possible to document what the "quiet" time is ;)

How about

#define ARCH_DLINFO
-do if (vdso_enabled) {
+do if (VDSO_BASE) {
?

Oleg.

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