linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bad error return after find_vma() in PR_SET_MM code
@ 2012-04-15  4:00 Michael Kerrisk (man-pages)
       [not found] ` <CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2012-04-15  4:00 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: Pavel Emelyanov, linux-man, LKML, Tejun Heo, Andrew Morton,
	Michael Kerrisk

[Bother! Resending with corrected subject line (was "[PATCH 1/2]
prctl: Add PR_SET_MM option description")]

Cyrill,

While reviewing your patch to the prctl() manual page, I noticed the
following code in kernel/sys.c::prctl_set_mm():

       if (opt != PR_SET_MM_START_BRK && opt != PR_SET_MM_BRK) {
               /* It must be existing VMA */
               if (!vma || vma->vm_start > addr)
                       goto out;
       }

At this point, the code causes an exit with error set to zero (i.e.,
success). This looks unintended to me. Is the code correct? I suspect
a return of -EFAULT or -ENOMEM is warranted.

Cheers,

Michael

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bad error return after find_vma() in PR_SET_MM code
       [not found] ` <CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-04-24 15:12   ` KOSAKI Motohiro
       [not found]     ` <4F96C2CF.5070900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2012-04-24 15:12 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: Cyrill Gorcunov, Pavel Emelyanov,
	linux-man-u79uwXL29TY76Z2rM5mHXA, LKML, Tejun Heo, Andrew Morton,
	kosaki.motohiro-Re5JQEeQqe8AvxtiuMwx3w

(4/15/12 12:00 AM), Michael Kerrisk (man-pages) wrote:
> [Bother! Resending with corrected subject line (was "[PATCH 1/2]
> prctl: Add PR_SET_MM option description")]
>
> Cyrill,
>
> While reviewing your patch to the prctl() manual page, I noticed the
> following code in kernel/sys.c::prctl_set_mm():
>
>         if (opt != PR_SET_MM_START_BRK&&  opt != PR_SET_MM_BRK) {
>                 /* It must be existing VMA */
>                 if (!vma || vma->vm_start>  addr)
>                         goto out;
>         }
>
> At this point, the code causes an exit with error set to zero (i.e.,
> success). This looks unintended to me. Is the code correct? I suspect
> a return of -EFAULT or -ENOMEM is warranted.

EFAULT please when detecting invalid vma.

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bad error return after find_vma() in PR_SET_MM code
       [not found]     ` <4F96C2CF.5070900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-04-24 15:15       ` Cyrill Gorcunov
  0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2012-04-24 15:15 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, Pavel Emelyanov,
	linux-man-u79uwXL29TY76Z2rM5mHXA, LKML, Tejun Heo, Andrew Morton

On Tue, Apr 24, 2012 at 11:12:15AM -0400, KOSAKI Motohiro wrote:
> (4/15/12 12:00 AM), Michael Kerrisk (man-pages) wrote:
> >[Bother! Resending with corrected subject line (was "[PATCH 1/2]
> >prctl: Add PR_SET_MM option description")]
> >
> >Cyrill,
> >
> >While reviewing your patch to the prctl() manual page, I noticed the
> >following code in kernel/sys.c::prctl_set_mm():
> >
> >        if (opt != PR_SET_MM_START_BRK&&  opt != PR_SET_MM_BRK) {
> >                /* It must be existing VMA */
> >                if (!vma || vma->vm_start>  addr)
> >                        goto out;
> >        }
> >
> >At this point, the code causes an exit with error set to zero (i.e.,
> >success). This looks unintended to me. Is the code correct? I suspect
> >a return of -EFAULT or -ENOMEM is warranted.
> 
> EFAULT please when detecting invalid vma.

Thanks for reminder, Kosaki! I'll cook a patch asap.

	Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-24 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-15  4:00 Bad error return after find_vma() in PR_SET_MM code Michael Kerrisk (man-pages)
     [not found] ` <CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-24 15:12   ` KOSAKI Motohiro
     [not found]     ` <4F96C2CF.5070900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-24 15:15       ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).