nptl: Use __mprotect consistently for _STACK_GROWS_UP

Message ID 20180712124509.8516143994575@oldenburg.str.redhat.com
State New
Headers show
Series
  • nptl: Use __mprotect consistently for _STACK_GROWS_UP
Related show

Commit Message

Florian Weimer July 12, 2018, 12:45 p.m.
2018-07-12  Florian Weimer  <fweimer@redhat.com>

	* nptl/allocatestack.c [_STACK_GROWS_UP] (allocate_stack): Call
	__mprotect, not mprotect.

Comments

H.J. Lu July 12, 2018, 12:52 p.m. | #1
On Thu, Jul 12, 2018 at 5:45 AM, Florian Weimer <fweimer@redhat.com> wrote:
> 2018-07-12  Florian Weimer  <fweimer@redhat.com>
>
>         * nptl/allocatestack.c [_STACK_GROWS_UP] (allocate_stack): Call
>         __mprotect, not mprotect.
>
> diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
> index f9e053f9e5..04e3f08465 100644
> --- a/nptl/allocatestack.c
> +++ b/nptl/allocatestack.c
> @@ -728,7 +728,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
>           /* The guard size difference might be > 0, but once rounded
>              to the nearest page the size difference might be zero.  */
>           if (new_guard > old_guard
> -             && mprotect (old_guard, new_guard - old_guard, prot) != 0)
> +             && __mprotect (old_guard, new_guard - old_guard, prot) != 0)
>             goto mprot_error;
>  #endif
>

That is OK.

Thanks.
Carlos O'Donell July 12, 2018, 1 p.m. | #2
On 07/12/2018 08:45 AM, Florian Weimer wrote:
> 2018-07-12  Florian Weimer  <fweimer@redhat.com>
> 
> 	* nptl/allocatestack.c [_STACK_GROWS_UP] (allocate_stack): Call
> 	__mprotect, not mprotect.
> 
> diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
> index f9e053f9e5..04e3f08465 100644
> --- a/nptl/allocatestack.c
> +++ b/nptl/allocatestack.c
> @@ -728,7 +728,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
>           /* The guard size difference might be > 0, but once rounded
>              to the nearest page the size difference might be zero.  */
>           if (new_guard > old_guard
> -             && mprotect (old_guard, new_guard - old_guard, prot) != 0)
> +             && __mprotect (old_guard, new_guard - old_guard, prot) != 0)
>  	    goto mprot_error;
>  #endif
>  
> 

This is OK. Please commit.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Patch

diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index f9e053f9e5..04e3f08465 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -728,7 +728,7 @@  allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
          /* The guard size difference might be > 0, but once rounded
             to the nearest page the size difference might be zero.  */
          if (new_guard > old_guard
-             && mprotect (old_guard, new_guard - old_guard, prot) != 0)
+             && __mprotect (old_guard, new_guard - old_guard, prot) != 0)
 	    goto mprot_error;
 #endif