lkml.org 
[lkml]   [2012]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: sys_kcmp (was: Re: [PATCH 1/2] ARM: add finit_module syscall to ARM)
From
Date
On Mon, 2012-09-24 at 21:42 +0400, Cyrill Gorcunov wrote:
> On Mon, Sep 24, 2012 at 08:49:42PM +0400, Cyrill Gorcunov wrote:
> > > I got past that with:
> > >
> > > diff --git a/include/linux/security.h b/include/linux/security.h
> > > index 01ef030..14e394d 100644
> > > --- a/include/linux/security.h
> > > +++ b/include/linux/security.h
> > > @@ -118,6 +118,7 @@ void reset_security_ops(void);
> > > extern unsigned long mmap_min_addr;
> > > extern unsigned long dac_mmap_min_addr;
> > > #else
> > > +#define mmap_min_addr 0UL
> > > #define dac_mmap_min_addr 0UL
> > > #endif
> > >
>
> I think better to add CONFIG_MMU test here.

Well, my patch was just something quick to get the kernel to build, but
thinking about it a bit, I still prefer it. The CONFIG_MMU check is in
security.h already so I think it is less clutter and better for future
code which may use mmap_min_addr. In any case, the compiler will drop
any test for "x < 0UL" so the end result is the same.

> ---
> From: Cyrill Gorcunov <gorcunov@openvz.org>
> Subject: prctl: prctl_set_mm -- Don't test for mmap_min_addr on non-MMU config
>
> In case if CONFIG_MMU is not set the @mmap_min_addr
> is undefined leading to build error. Thus test for
> it iif CONFIG_MMU is present.
>
> Note this code snippet depends on CONFIG_CHECKPOINT_RESTORE=y.
>
> Reported-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
> kernel/sys.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> Index: linux-2.6.git/kernel/sys.c
> ===================================================================
> --- linux-2.6.git.orig/kernel/sys.c
> +++ linux-2.6.git/kernel/sys.c
> @@ -1865,7 +1865,11 @@ static int prctl_set_mm(int opt, unsigne
> if (opt == PR_SET_MM_EXE_FILE)
> return prctl_set_mm_exe_file(mm, (unsigned int)addr);
>
> +#ifdef CONFIG_MMU
> if (addr >= TASK_SIZE || addr < mmap_min_addr)
> +#else
> + if (addr >= TASK_SIZE)
> +#endif
> return -EINVAL;
>
> error = -EINVAL;




\
 
 \ /
  Last update: 2012-09-24 21:01    [W:0.080 / U:2.028 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site