All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Salter <msalter@redhat.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Russell King <rmk@arm.linux.org.uk>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org,
	Linux-Arch <linux-arch@vger.kernel.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Pavel Emelyanov <xemul@parallels.com>
Subject: Re: sys_kcmp (was: Re: [PATCH 1/2] ARM: add finit_module syscall to ARM)
Date: Mon, 24 Sep 2012 14:16:09 -0400	[thread overview]
Message-ID: <1348510573.20929.44.camel@deneb.redhat.com> (raw)
In-Reply-To: <20120924174256.GD24172@moon>

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;

  reply	other threads:[~2012-09-24 18:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-22 10:56 sys_kcmp (was: Re: [PATCH 1/2] ARM: add finit_module syscall to ARM) Geert Uytterhoeven
2012-09-22 11:45 ` Cyrill Gorcunov
2012-09-22 13:20   ` Russell King
2012-09-22 13:38     ` Ralf Baechle
2012-09-22 15:37       ` Cyrill Gorcunov
2012-09-22 18:47     ` Andrew Morton
2012-09-24 16:21       ` Mark Salter
2012-09-24 16:49         ` Cyrill Gorcunov
2012-09-24 17:42           ` Cyrill Gorcunov
2012-09-24 18:16             ` Mark Salter [this message]
2012-09-24 18:55               ` Cyrill Gorcunov
2012-09-24 18:29             ` sys_kcmp Eric W. Biederman
2012-09-24 18:51               ` sys_kcmp Cyrill Gorcunov
2012-09-24 20:35                 ` sys_kcmp Cyrill Gorcunov
2012-09-24 20:44                   ` sys_kcmp Eric W. Biederman
2012-09-24 20:53                     ` sys_kcmp Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348510573.20929.44.camel@deneb.redhat.com \
    --to=msalter@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=geert@linux-m68k.org \
    --cc=gorcunov@openvz.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.