mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Arjan van de Ven <arjan@infradead.org>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [patch] x86: test case for the RODATA config option
Date: Wed, 23 Jan 2008 12:11:41 +1100	[thread overview]
Message-ID: <200801231211.41750.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20080122144420.4ebcf95f@laptopd505.fenrus.org>

On Wednesday 23 January 2008 09:44, Arjan van de Ven wrote:
> From: Arjan van de Ven <arjan@linux.intel.com>
> Subject: x86: test case for the RODATA config option
>
> This patch adds a test module for the DEBUG_RODATA config
> option to make sure change_page_attr() did indeed make
> "const" data read only.
>
> This testcase both tests the DEBUG_RODATA code as well as
> the change_page_attr() code for correct operation.
>
> When the tests/ patch gets merged, this module should move
> to the tests/ directory.
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
>  arch/x86/Kconfig.debug        |    8 +++++
>  arch/x86/kernel/Makefile_32   |    1
>  arch/x86/kernel/Makefile_64   |    2 +
>  arch/x86/kernel/test_rodata.c |   65
> ++++++++++++++++++++++++++++++++++++++++++ arch/x86/mm/init_32.c         | 
>   3 +
>  arch/x86/mm/init_64.c         |    3 +
>  6 files changed, 82 insertions(+)
>
> Index: linux-2.6.24-rc8/arch/x86/Kconfig.debug
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/x86/Kconfig.debug
> +++ linux-2.6.24-rc8/arch/x86/Kconfig.debug
> @@ -57,6 +57,14 @@ config DEBUG_RODATA
>  	  portion of the kernel code won't be covered by a 2MB TLB anymore.
>  	  If in doubt, say "N".
>
> +config DEBUG_RODATA_TEST
> +	tristate "Testcase for the DEBUG_RODATA feature"
> +	depends on DEBUG_RODATA && m
> +	help
> +	  This option enables a testcase for the DEBUG_RODATA
> +	  feature as well as for the change_page_attr() infrastructure.
> +	  If in doubt, say "N"
> +
>  config 4KSTACKS
>  	bool "Use 4Kb for kernel stacks instead of 8Kb"
>  	depends on DEBUG_KERNEL
> Index: linux-2.6.24-rc8/arch/x86/mm/init_32.c
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/x86/mm/init_32.c
> +++ linux-2.6.24-rc8/arch/x86/mm/init_32.c
> @@ -790,6 +790,9 @@ static int noinline do_test_wp_bit(void)
>
>  #ifdef CONFIG_DEBUG_RODATA
>
> +const int rodata_test_data;
> +EXPORT_SYMBOL_GPL(rodata_test_data);
> +
>  void mark_rodata_ro(void)
>  {
>  	unsigned long start = PFN_ALIGN(_text);
> Index: linux-2.6.24-rc8/arch/x86/mm/init_64.c
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/x86/mm/init_64.c
> +++ linux-2.6.24-rc8/arch/x86/mm/init_64.c
> @@ -590,6 +590,9 @@ void free_initmem(void)
>
>  #ifdef CONFIG_DEBUG_RODATA
>
> +const int rodata_test_data = 5;

I guess this should match the 32-bit case, and be zero instead of
5?

Can you disallow building as a module, and put this in the test
code? It could be run from the end of mark_rodata_ro()...

  parent reply	other threads:[~2008-01-23  1:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 22:44 Arjan van de Ven
2008-01-23  0:04 ` Ingo Molnar
2008-01-23  1:11 ` Nick Piggin [this message]
2008-01-23  5:29   ` Arjan van de Ven
2008-01-23  9:09 ` Andi Kleen
2008-01-23 14:49   ` Arjan van de Ven
2008-01-23 15:27     ` Andi Kleen
2008-01-23 16:04       ` Arjan van de Ven
2008-01-23 16:54         ` Andi Kleen
2008-01-23 17:49           ` Arjan van de Ven

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=200801231211.41750.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®