public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: pageexec@freemail.hu
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [patch 06/11] Text Edit Lock - Alternative code for x86
Date: Tue, 13 Nov 2007 17:10:12 -0500	[thread overview]
Message-ID: <20071113221012.GC9057@Krystal> (raw)
In-Reply-To: <473A2B1A.16967.38D5698D@pageexec.freemail.hu>

* pageexec@freemail.hu (pageexec@freemail.hu) wrote:
> On 13 Nov 2007 at 13:46, Mathieu Desnoyers wrote:
> 
> > +void *text_poke_early(void *addr, const void *opcode, size_t len)
> > +{
> > +	memcpy(addr, opcode, len);
> > +	text_sync(addr, len);
> > +	return addr;
> > +}
> 
> why do you need this function (vs. using text_poke throughout)?
> 

Because it's not safe to use read_cr0() in paravirtualization
before the alternatives are set.

> > +#define kernel_wp_save(cr0)					\
> > +	do {							\
> > +		preempt_disable();				\
> > +		cr0 = read_cr0();				\
> > +		if (cpu_data(smp_processor_id()).wp_works_ok)	\
> 
> why do you need this test? if cr0.wp is ineffective, then it doesn't
> matter whether it's on or off (in fact, at least the intel manual
> says that 386s would not even let you change its value, they'll
> silently ignore attempts of setting the wp bit).
> 

Ok.. then this test could go away then. I prefered to use a conservative
approach. Will fix. Thanks for the hint.

Mathieu

> > +			write_cr0(cr0 & ~X86_CR0_WP);		\
> > +	} while (0)
> > +
> > +#define kernel_wp_restore(cr0)					\
> > +	do {							\
> > +		if (cpu_data(smp_processor_id()).wp_works_ok)	\
> 
> ditto...
> 
> > +			write_cr0(cr0);				\
> > +		preempt_enable();				\
> > +	} while (0)
> >  
> >  #endif /* _I386_ALTERNATIVE_H */
> 
> 

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2007-11-13 22:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13 18:46 [patch 00/11] Text Edit Lock Mathieu Desnoyers
2007-11-13 18:46 ` [patch 01/11] Kprobes - use a mutex to protect the instruction pages list Mathieu Desnoyers
2007-11-13 18:46 ` [patch 02/11] Kprobes - do not use kprobes mutex in arch code Mathieu Desnoyers
2007-11-13 18:46 ` [patch 03/11] Kprobes - declare kprobe_mutex static Mathieu Desnoyers
2007-11-13 18:46 ` [patch 04/11] Add INIT_ARRAY() to kernel.h Mathieu Desnoyers
2007-11-13 18:46 ` [patch 05/11] Text Edit Lock - Architecture Independent Code Mathieu Desnoyers
2007-11-13 18:46 ` [patch 06/11] Text Edit Lock - Alternative code for x86 Mathieu Desnoyers
2007-11-13 20:54   ` pageexec
2007-11-13 22:10     ` Mathieu Desnoyers [this message]
2007-11-14  1:42     ` [patch 06/11] Text Edit Lock - Alternative code for x86 (updated) Mathieu Desnoyers
2007-11-13 18:46 ` [patch 07/11] Text Edit Lock - kprobes architecture independent support Mathieu Desnoyers
2007-11-13 18:46 ` [patch 08/11] Text Edit Lock - kprobes x86_32 Mathieu Desnoyers
2007-11-13 18:46 ` [patch 09/11] Text Edit Lock - kprobes x86_64 Mathieu Desnoyers
2007-11-13 18:46 ` [patch 10/11] Text Edit Lock - x86_32 standardize debug rodata Mathieu Desnoyers
2007-11-13 18:46 ` [patch 11/11] Text Edit Lock - x86_64 " Mathieu Desnoyers
  -- strict thread matches above, loose matches on Subject: below --
2007-12-06  2:02 [patch 00/11] Text Edit Lock for 2.6.24-rc4-git3 Mathieu Desnoyers
2007-12-06  2:02 ` [patch 06/11] Text Edit Lock - Alternative code for x86 Mathieu Desnoyers
2007-12-06 12:19   ` pageexec
2007-12-06 14:21     ` Mathieu Desnoyers
2007-12-06 14:44     ` Mathieu Desnoyers
2007-12-06 13:58       ` pageexec

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=20071113221012.GC9057@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pageexec@freemail.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