All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Alex Henrie <alexhenrie24@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Doug Johnson <dougvj@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Tyler Hicks <tyhicks@canonical.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Preserve iopl on fork and execve
Date: Mon, 11 May 2015 13:57:27 -0700	[thread overview]
Message-ID: <555117B7.6040608@zytor.com> (raw)
In-Reply-To: <1431377398-12046-1-git-send-email-alexhenrie24@gmail.com>

On 05/11/2015 01:49 PM, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> Suggested-by: Doug Johnson <dougvj@dougvj.net>
> ---
>  arch/x86/kernel/process_32.c | 2 +-
>  arch/x86/kernel/process_64.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
> index 8ed2106..86bfe7c 100644
> --- a/arch/x86/kernel/process_32.c
> +++ b/arch/x86/kernel/process_32.c
> @@ -205,7 +205,7 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
>  	regs->cs		= __USER_CS;
>  	regs->ip		= new_ip;
>  	regs->sp		= new_sp;
> -	regs->flags		= X86_EFLAGS_IF;
> +	regs->flags		|= X86_EFLAGS_IF;
>  	force_iret();
>  }
>  EXPORT_SYMBOL_GPL(start_thread);
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index ddfdbf7..fc22e5d 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -238,7 +238,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
>  	regs->sp		= new_sp;
>  	regs->cs		= _cs;
>  	regs->ss		= _ss;
> -	regs->flags		= X86_EFLAGS_IF;
> +	regs->flags		|= X86_EFLAGS_IF;
>  	force_iret();
>  }
>  

This would seem to preserve a whole bunch of other flags that should not
be leaked between processes, such as DF or TF.

	-hpa



  reply	other threads:[~2015-05-11 20:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 20:49 [PATCH] x86: Preserve iopl on fork and execve Alex Henrie
2015-05-11 20:57 ` H. Peter Anvin [this message]
2015-05-11 21:09 ` One Thousand Gnomes

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=555117B7.6040608@zytor.com \
    --to=hpa@zytor.com \
    --cc=alexhenrie24@gmail.com \
    --cc=dougvj@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tyhicks@canonical.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.