public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Coywolf Qi Hunt <coywolf@gmail.com>
To: Andi Kleen <ak@suse.de>
Cc: coywolf@sosdg.org, linux-kernel@vger.kernel.org,
	Arjan van de Ven <arjan@infradead.org>,
	Josh Boyer <jdub@us.ibm.com>,
	akpm@osdl.org
Subject: Re: [patch] mark text section read-only
Date: Sat, 12 Nov 2005 22:32:34 +0800	[thread overview]
Message-ID: <2cd57c900511120632y1e7993ber@mail.gmail.com> (raw)
In-Reply-To: <200511112243.42255.ak@suse.de>

2005/11/12, Andi Kleen <ak@suse.de>:
> On Friday 11 November 2005 20:04, Coywolf Qi Hunt wrote:
> > On Sat, Nov 12, 2005 at 02:57:02AM +0800, Coywolf Qi Hunt wrote:
> > > And we could also mark text section read-only and data/stack section
> > > noexec if NX is supported. But I doubt the whole thing would really
> > > help much. Kill the kernel thread? We can't. We only run into a panic.
> > > Anyway I'd attach a quick patch to mark text section read only in the
> > > next mail.
>
>
> I think this whole thing is only usable as a debugging option. It shouldn't
> be used by default on production systems because it will increase TLB
> pressure by splitting up the large pages used by kernel. And TLB pressure
> is critical in many workloads.
>
> It definitely shouldn't be on by default.
>
> Then the text section will likely not be page aligned, so it would be
> surprising if it even worked.

It works. I have tested it with { c=_stext[0]; _stext[0]=c;}. No
effect when it's disabled; panic when it's enabled.

The symbol `_text' is always page aligned. `_etext' is not, but we don't care.

(Bugs: It would conflict with kprobes.)

>
> At least on x86-64 it is pretty useless too because the .text section can
> be accessed over its alias in the direct mapping.

OK, for x86 only then.

>
> Overall I doubt it is worth it even as a debugging option. I so far cannot
> remember a single bug that was caused by overwriting kernel text.

I had the same concern basically. But I am convinced after seeing the
bug Nikita Danilov points out.
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

  parent reply	other threads:[~2005-11-12 14:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-07 10:56 [patch 01/02] Debug option to write-protect rodata: change_page_attr fixes arjan
2005-11-07 10:58 ` [patch 02/02] Debug option to write-protect rodata: the write protect logic and config option arjan
2005-11-07 14:06   ` Josh Boyer
2005-11-07 14:20     ` Arjan van de Ven
2005-11-11  9:39       ` Coywolf Qi Hunt
2005-11-11  9:47         ` Arjan van de Ven
2005-11-11 18:57           ` Coywolf Qi Hunt
2005-11-11 19:04             ` [patch] mark text section read-only Coywolf Qi Hunt
2005-11-11 19:09               ` Arjan van de Ven
2005-11-11 19:34               ` linux-os (Dick Johnson)
2005-11-12 14:01                 ` Coywolf Qi Hunt
2005-11-11 21:43               ` Andi Kleen
2005-11-11 23:30                 ` Nikita Danilov
2005-11-12 17:26                   ` Andi Kleen
2005-11-12 14:32                 ` Coywolf Qi Hunt [this message]
2005-11-12 16:34                   ` Coywolf Qi Hunt
2005-11-13  4:50                     ` Keith Owens
2005-11-14 13:34               ` Linh Dang
     [not found] <56cTZ-2PF-5@gated-at.bofh.it>
     [not found] ` <56cTZ-2PF-3@gated-at.bofh.it>
     [not found]   ` <56fRE-7wr-21@gated-at.bofh.it>
     [not found]     ` <56gaT-7Un-17@gated-at.bofh.it>
     [not found]       ` <57DHW-jb-21@gated-at.bofh.it>
     [not found]         ` <57DHW-jb-19@gated-at.bofh.it>
     [not found]           ` <57Mia-4BG-5@gated-at.bofh.it>
     [not found]             ` <57MrY-50s-39@gated-at.bofh.it>
2005-11-11 23:03               ` Bodo Eggert
2005-11-12  4:42                 ` Coywolf Qi Hunt

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=2cd57c900511120632y1e7993ber@mail.gmail.com \
    --to=coywolf@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=coywolf@sosdg.org \
    --cc=jdub@us.ibm.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox