lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080415002918.6a3b40b6.akpm@linux-foundation.org>
Date:	Tue, 15 Apr 2008 00:29:18 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Erik Bosman <ebn310@....vu.nl>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrea Arcangeli <andrea@...share.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] x86: Implement prctl PR_GET_TSC and PR_SET_TSC

On Fri, 11 Apr 2008 18:55:58 +0200 (CEST) Erik Bosman <ebn310@....vu.nl> wrote:

> 
>     x86: Implement prctl PR_GET_TSC and PR_SET_TSC
> 
>     This patch adds a configure option CONFIG_DISABLE_TSC
>     (off by default) for the x86 platform to enable the
>     PR_GET_TSC and PR_SET_TSC commands. These control the
>     ability to use the timestamp counter from userspace
>     (the RDTSC instruction.)
> 
>     This patch uses code earlier used to disable the
>     timestamp counter for the SECCOMP framework. It used
>     to disable the RDTSC on 32 bit kernels, but allow it
>     on x86_64. This patch makes SECCOMP disable the
>     timestamp counter whenever CONFIG_DISABLE_TSC is
>     enabled.
> 
> ...
>
> +config DISABLE_TSC
> +	def_bool n
> +	prompt "Make availability of the RDTSC instruction configurable"
> +	depends on (X86_32 || X86_64) && EXPERIMENTAL
> +	help
> +	  While the RDTSC instruction allows for very precise time
> +	  measurements, it is also a source for non-determinism
> +	  during the execution of a process which can be a problem in some
> +	  security contexts. This option adds prctl commands to configure
> +	  and test the availability of the RDTSC instruction on a
> +	  per-process basis. Choosing this option may cause a small
> +	  performance hit during context switching.
> +
> +	  If unsure, say N.
> +
>  config SECCOMP
>  	def_bool y
>  	prompt "Enable seccomp to safely compute untrusted bytecode"
> diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
> index 6496344..e6a861f 100644
> --- a/arch/x86/kernel/process_32.c
> +++ b/arch/x86/kernel/process_32.c
> @@ -36,6 +36,7 @@
>  #include <linux/personality.h>
>  #include <linux/tick.h>
>  #include <linux/percpu.h>
> +#include <linux/prctl.h>
> 
>  #include <asm/uaccess.h>
>  #include <asm/pgtable.h>
> @@ -528,11 +529,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
>  }
>  EXPORT_SYMBOL_GPL(start_thread);
> 
> -#ifdef CONFIG_SECCOMP
> +#ifdef CONFIG_DISABLE_TSC
>  static void hard_disable_TSC(void)
>  {
>  	write_cr4(read_cr4() | X86_CR4_TSD);
>  }

Won't this break this build if CONFIG_DISABLE_TSC=n and CONFIG_SECCOMP=y?


The prctl.h and sys.c parts look OK to me.  I'll consider this a git-x86
patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ