This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: Enable no-exec stacks for more targets using the Linux kernel
- From: Nagaraju Mekala <nmekala at xilinx dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "schwab at suse dot de" <schwab at suse dot de>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "law at redhat dot com" <law at redhat dot com>, "dave at anglin dot bell dot net" <dave at anglin dot bell dot net>, "wilson at tuliptree dot org" <wilson at tuliptree dot org>, Michael Eager <eager at eagercon dot com>
- Date: Thu, 21 Sep 2017 09:25:40 +0000
- Subject: RE: Enable no-exec stacks for more targets using the Linux kernel
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=nmekala at xilinx dot com;
- References: <CY4PR02MB3159EE5121CD966FE3FB5A56D6610@CY4PR02MB3159.namprd02.prod.outlook.com> <alpine.DEB.2.20.1709201219120.7663@digraph.polyomino.org.uk>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> -----Original Message-----
> From: Joseph Myers [mailto:joseph@codesourcery.com]
> Sent: Wednesday, September 20, 2017 5:52 PM
> To: Nagaraju Mekala <nmekala@xilinx.com>
> Cc: schwab@suse.de; gcc-patches@gcc.gnu.org; law@redhat.com;
> dave@anglin.bell.net; wilson@tuliptree.org; Michael Eager
> <eager@eagercon.com>
> Subject: Re: Enable no-exec stacks for more targets using the Linux kernel
>
> On Wed, 20 Sep 2017, Nagaraju Mekala wrote:
>
> > > I've sent a glibc patch
> > > <https://sourceware.org/ml/libc-alpha/2017-09/msg00734.html>. I
> > >think the key questions for architecture experts now are: on each of
> > >those three architectures, do trampolines ever require executable
> > >stacks, and, if they do, how does this work at present when the
> > >kernel defaults to non-executable and my understanding at
> > ><https://sourceware.org/ml/libc-alpha/2017-09/msg00747.html> would be
> > >that glibc would only make thread stacks executable on those
> > >architectures, not the main process stacks, and GCC will never
> > >generate an explicit marker on those architectures to request an executable
> stack?
> >
> > Microblaze is a soft processor with many configuration options. If we
> > don't use the MMU, there is nothing preventing execution of code on
> > the stack in the MicroBlaze architecture.
> > With the MMU, you have the option to make any page, including the
> > stack pages, executable or not.
> >
> > It is recommended to prevent execution on the stack by defining those
> > pages as non-executable in the MMU. In particular, trampolines would
> > have to be possible to code without execution on the stack
>
> No-MMU configurations are not relevant to a glibc change; the question is
> how things work for configurations using glibc, with the Linux kernel, with an
> MMU. In such a configuration, for MicroBlaze: (a) is the stack in fact
> executable, now; (b) if it is, what makes it so given the kernel default to non-
> executable (where does my reasoning about what the kernel and glibc do go
> wrong); (c) if it is not executable, do trampolines work anyway?
The MMU configuration doesn't need stack to be executable.
The glibc patch related to Microblaze looks correct and it should solve the issue.
We will verify the change in a day or two and get back to you.
Thanks,
Nagaraju
> --
> Joseph S. Myers
> joseph@codesourcery.com