linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Alexey Dobriyan <adobriyan@gmail.com>, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	security@kernel.org
Subject: Re: [PATCH] ELF: warn if process starts with executable stack
Date: Mon, 18 Nov 2019 17:13:41 +0000	[thread overview]
Message-ID: <1981366e-93d7-79bd-749f-d5d08d689a52@codethink.co.uk> (raw)
In-Reply-To: <20191118145114.GA9228@avx2>

On 18/11/2019 14:51, Alexey Dobriyan wrote:
> PT_GNU_STACK is fail open design, at least warn people that something
> isn't right.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>   fs/exec.c |    7 +++++++
>   1 file changed, 7 insertions(+)
> 
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -762,6 +762,13 @@ int setup_arg_pages(struct linux_binprm *bprm,
>   		goto out_unlock;
>   	BUG_ON(prev != vma);
>   

it might be worth to use:
  if (IS_ENABLED(CONFIG_MMU) && vm_flags & VM_EXEC) {

instead of the #ifdef


> +#ifdef CONFIG_MMU
> +	if (vm_flags & VM_EXEC) {
> +		pr_warn_once("process '%s'/%u started with executable stack\n",
> +			     current->comm, current->pid);
> +	}
> +#endif
> +
>   	/* Move stack pages down in memory. */
>   	if (stack_shift) {
>   		ret = shift_arg_pages(vma, stack_shift);
> 


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

  reply	other threads:[~2019-11-18 17:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 14:51 Alexey Dobriyan
2019-11-18 17:13 ` Ben Dooks [this message]
2019-11-18 20:54 ` Andrew Morton
2019-11-18 21:36   ` Alexey Dobriyan
2019-11-18 21:52   ` [PATCH] exec: " Alexey Dobriyan
2019-11-19  5:32     ` Dan Carpenter
2019-11-20 19:17     ` Will Deacon
2019-11-20 20:28       ` Eric W. Biederman
2019-11-21  9:38         ` Will Deacon
2019-12-08 16:43           ` Alexey Dobriyan

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=1981366e-93d7-79bd-749f-d5d08d689a52@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=security@kernel.org \
    --subject='Re: [PATCH] ELF: warn if process starts with executable stack' \
    /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

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).