Re: [RFC 2/2] prctl: PR_SET_MM -- Introduce PR_SET_MM_MAP operation

From: Cyrill Gorcunov
Date: Fri Jul 04 2014 - 04:12:07 EST


On Fri, Jul 04, 2014 at 11:52:56AM +0400, Andrew Vagin wrote:
> > +
> > +struct prctl_mm_map {
> > + unsigned long start_code;
>
> "unsigned long" has different sizes on x86_64 and x86, so a compat
> is required for x32 processes on x64 kernel.

Yes, good point. I think we can use u64/32 types instead to make
a code shared. I'll update once I collect all comments about
aproach.

> > +
> > + /*
> > + * Stack, brk, command line arguments and environment must exist.
> > + */
> > + stack_vma = find_vma(mm, prctl_map->start_stack);
>
> Why do we not use __prctl_check_vma here?

Well __prctl_check_vma does return error or zero while I need this
vma reference for stack rlim check which is done below in code.
>
> > + if (!stack_vma) {
> > + error = -EINVAL;
> > + goto out;
> > + }
> > +#define __prctl_check_vma(mm, addr) find_vma(mm, addr) ? 0 : -EINVAL
> > + error |= __prctl_check_vma(mm, prctl_map->start_brk);
> > + error |= __prctl_check_vma(mm, prctl_map->brk);

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