linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jon Loeliger <jdl@freescale.com>
To: Scott Wood <scottwood@freescale.com>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH v2] Allow exec on 32-bit from readable, non-exec pages, with a warning.
Date: Tue, 17 Jul 2007 15:46:08 -0500	[thread overview]
Message-ID: <1184705168.24473.32.camel@ld0161-tx32> (raw)
In-Reply-To: <20070709214853.GA29912@ld0162-tx32.am.freescale.net>

On Mon, 2007-07-09 at 16:48, Scott Wood wrote:
> In older versions of glibc (through 2.3), the dynamic linker executes a
> small amount of code from the data segment, which is not marked as
> executable.  A recent change (commit 9ba4ace39fdfe22268daca9f28c5df384ae462cf)
> stops this from working; there should be a deprecation period before
> older glibc versions stop working.
> 
> The problem has been observed on glibc 2.2.  While glibc 2.3 has the same
> code, I did not see the problem; it may be that it accesses the page in
> question as data before executing from it, and thus it is already mapped.
> 
> Note that this only applies to the classic 32-bit PowerPC MMU and the
> MPC8xx MMU, not Book E, 64-bit, etc.  These MMUs do not support per-page
> no-exec, and thus this patch isn't taking away any effective protection
> enforcement.  Currently, such accesses will fail only if the page in
> question has not already been faulted on (and thus mapped).
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---

Well now.  I've spent a good chunk of today with Our Friend, git-bisect,
verifying that, in fact, the commit 9ba4ace39fdfe22268daca9f28c5df384ae462cf
breaks the 8641 HPCN port.  init doesn't run off an old NFS'ed root FS
worth a Steven J Hill of beans.

But luckily, this gave me the opportunity to then realize that
we should give a great big...

Amen-brother-by: Jon Loeliger <jdl@freescale.com>

to this patch from Scott.

So, an official plea to Paul to apply this to his tree.

jdl


> v2: Added to the changelog to explain why this change isn't harmful.
> 
>  arch/powerpc/mm/fault.c |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 0ece513..2445512 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -125,6 +125,18 @@ static void do_dabr(struct pt_regs *regs, unsigned long address,
>  }
>  #endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/
>  
> +#ifdef CONFIG_PPC32
> +static void warn_exec_from_noexec(void)
> +{
> +	if (printk_ratelimit())
> +		printk(KERN_WARNING "Process %s (%d) attempted to execute from "
> +		                    "a non-executable page.\n"
> +		       KERN_WARNING "This may stop working in future kernels.  "
> +		                    "Please upgrade your libc.\n",
> +		       current->comm, current->pid);
> +}
> +#endif
> +
>  /*
>   * For 600- and 800-family processors, the error_code parameter is DSISR
>   * for a data fault, SRR1 for an instruction fault. For 400-family processors
> @@ -283,8 +295,16 @@ good_area:
>  		/* protection fault */
>  		if (error_code & DSISR_PROTFAULT)
>  			goto bad_area;
> -		if (!(vma->vm_flags & VM_EXEC))
> +		if (!(vma->vm_flags & VM_EXEC)) {
> +#ifdef CONFIG_PPC32
> +			if (vma->vm_flags & VM_READ)
> +				warn_exec_from_noexec();
> +			else
> +				goto bad_area;
> +#else
>  			goto bad_area;
> +#endif
> +		}
>  #else
>  		pte_t *ptep;
>  		pmd_t *pmdp;

  parent reply	other threads:[~2007-07-17 20:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09 21:48 [PATCH v2] Allow exec on 32-bit from readable, non-exec pages, with a warning Scott Wood
2007-07-10  3:01 ` Paul Mackerras
2007-07-11  0:16   ` Segher Boessenkool
2007-07-11 15:32     ` Scott Wood
2007-07-12  7:40       ` Kumar Gala
2007-07-16 12:55         ` Segher Boessenkool
2007-07-17 20:46 ` Jon Loeliger [this message]
2007-07-17 22:14   ` Scott Wood
2007-07-17 22:44     ` Jon Loeliger
2007-07-17 22:53       ` Scott Wood
2007-07-18  3:30         ` Segher Boessenkool
2007-07-18  6:02           ` Kumar Gala
2007-07-18 12:07             ` Segher Boessenkool
2007-07-18 14:13               ` Kumar Gala
2007-07-18 18:18       ` Linas Vepstas

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=1184705168.24473.32.camel@ld0161-tx32 \
    --to=jdl@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=scottwood@freescale.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 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).