All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Erik Bosman <ebn310@few.vu.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andrea Arcangeli <andrea@cpushare.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] x86: Implement prctl PR_GET_TSC and PR_SET_TSC
Date: Tue, 15 Apr 2008 00:29:18 -0700	[thread overview]
Message-ID: <20080415002918.6a3b40b6.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.GSO.4.56.0804111855070.16669@keg.few.vu.nl>

On Fri, 11 Apr 2008 18:55:58 +0200 (CEST) Erik Bosman <ebn310@few.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.

  parent reply	other threads:[~2008-04-15  7:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 16:55 [PATCH 2/3] x86: Implement prctl PR_GET_TSC and PR_SET_TSC Erik Bosman
2008-04-12 19:49 ` Arjan van de Ven
2008-04-12 20:48   ` H. Peter Anvin
2008-04-12 21:05     ` Erik Bosman
2008-04-12 21:12       ` Arjan van de Ven
2008-04-13 21:51     ` Erik Bosman
2008-04-13 22:02       ` H. Peter Anvin
2008-04-14  8:42         ` Ingo Molnar
2008-04-13 22:24 ` [PATCH 2/3-REVISED] " Erik Bosman
2008-04-14  3:58   ` Arjan van de Ven
2008-04-14  8:48     ` Ingo Molnar
2008-04-14 10:57 ` [PATCH 2/3] " Michael Kerrisk
2008-04-14 11:59   ` Erik Bosman
2008-04-14 12:21     ` Michael Kerrisk
2008-04-26 22:47     ` dean gaudet
2008-04-26 22:51       ` H. Peter Anvin
2008-04-26 23:14         ` dean gaudet
2008-04-26 23:46           ` H. Peter Anvin
2008-04-27  0:29             ` dean gaudet
2008-04-27  0:37               ` H. Peter Anvin
2008-04-27  0:47                 ` David Miller
2008-04-15  7:29 ` Andrew Morton [this message]
2008-04-15  7:46   ` Ingo Molnar

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=20080415002918.6a3b40b6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andrea@cpushare.com \
    --cc=ebn310@few.vu.nl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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.