lkml.org 
[lkml]   [2015]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: Preserve iopl on fork and execve
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




\
 
 \ /
  Last update: 2015-05-11 23:21    [W:0.033 / U:8.024 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site