* [Adeos-main] [Resent][RFC-PATCH] Instrument smp_processor_id /wrt illicit usage
@ 2007-09-15 7:51 Jan Kiszka
2007-10-04 8:13 ` Philippe Gerum
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2007-09-15 7:51 UTC (permalink / raw)
To: Philippe Gerum; +Cc: adeos-main
[-- Attachment #1.1: Type: text/plain, Size: 452 bytes --]
This is still in my local queue, don't recall anymore when we last
discussed it and if there was some issue remaining.
Anyway, here is a rebased set to detect calls of smp_processor_id() from
illicit contexts (non-root) on archs that bother about this. Only i386
is cared about so far, x86_64 and PowerPC should be treated similarly,
other (future) SMP-arch would arm the check automatically. Yet another
safety bag for porting I-pipe.
Jan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: instrument-smp_processor_id.patch --]
[-- Type: text/x-patch; name="instrument-smp_processor_id.patch", Size: 1238 bytes --]
---
lib/smp_processor_id.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
Index: linux-2.6.22-ipipe/lib/smp_processor_id.c
===================================================================
--- linux-2.6.22-ipipe.orig/lib/smp_processor_id.c
+++ linux-2.6.22-ipipe/lib/smp_processor_id.c
@@ -10,11 +10,27 @@
unsigned int debug_smp_processor_id(void)
{
unsigned long preempt_count = preempt_count();
- int this_cpu = raw_smp_processor_id();
+ int this_cpu = ipipe_processor_id();
cpumask_t this_mask;
- if (!ipipe_root_domain_p)
+#ifdef CONFIG_IPIPE
+ if (!ipipe_root_domain_p) {
+#ifndef IPIPE_STACK_INVARIANT_CPUID
+ if (test_bit(IPIPE_NOSTACK_FLAG, &ipipe_current_domain->
+ cpudata[this_cpu].status)) {
+ ipipe_trace_panic_freeze();
+ printk(KERN_ERR "BUG: using smp_processor_id() over "
+ "non-Linux stack. I-pipe domain: %s\n",
+ ipipe_current_domain->name);
+ print_symbol("caller is %s\n",
+ (long)__builtin_return_address(0));
+ dump_stack();
+ ipipe_trace_panic_dump();
+ }
+#endif /* !IPIPE_STACK_INVARIANT_CPUID */
goto out;
+ }
+#endif /* CONFIG_IPIPE */
if (likely(preempt_count))
goto out;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: instrument-smp_processor_id-i386.patch --]
[-- Type: text/x-patch; name="instrument-smp_processor_id-i386.patch", Size: 498 bytes --]
---
include/asm-i386/ipipe.h | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6.22-ipipe/include/asm-i386/ipipe.h
===================================================================
--- linux-2.6.22-ipipe.orig/include/asm-i386/ipipe.h
+++ linux-2.6.22-ipipe/include/asm-i386/ipipe.h
@@ -38,6 +38,7 @@
#include <asm/ptrace.h>
#define ipipe_processor_id() raw_smp_processor_id()
+#define IPIPE_STACK_INVARIANT_CPUID
#define prepare_arch_switch(next) \
do { \
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Adeos-main] [Resent][RFC-PATCH] Instrument smp_processor_id /wrt illicit usage
2007-09-15 7:51 [Adeos-main] [Resent][RFC-PATCH] Instrument smp_processor_id /wrt illicit usage Jan Kiszka
@ 2007-10-04 8:13 ` Philippe Gerum
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2007-10-04 8:13 UTC (permalink / raw)
To: Jan Kiszka; +Cc: adeos-main
On Sat, 2007-09-15 at 09:51 +0200, Jan Kiszka wrote:
> This is still in my local queue, don't recall anymore when we last
> discussed it and if there was some issue remaining.
>
> Anyway, here is a rebased set to detect calls of smp_processor_id() from
> illicit contexts (non-root) on archs that bother about this. Only i386
> is cared about so far, x86_64 and PowerPC should be treated similarly,
> other (future) SMP-arch would arm the check automatically. Yet another
> safety bag for porting I-pipe.
Last time, the ancestor of this patch badly broke my x86_84 setup,
causing hell in the NMI path for instance. A number of fixes you sent
lately have improved the situation since then for sure, so I will hold
those patches until the pending 2.6.22 issues are fixed, but will merge
in the end.
>
> Jan
--
Philippe.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-04 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-15 7:51 [Adeos-main] [Resent][RFC-PATCH] Instrument smp_processor_id /wrt illicit usage Jan Kiszka
2007-10-04 8:13 ` Philippe Gerum
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.