--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Aug 09, 2000 at 12:15:36PM +0100, Philipp Rumpf wrote:
> On Tue, Aug 08, 2000 at 05:22:38PM -0400, Josh Huber wrote:
> > +
> > + if(panic_on_oops)
> > + panic("oops, forcing panic");
> > +
> This looks bogus. It means if you set panic_on_oops, the next process
> calling sys_exit _will_ cause a panic. This belongs into
> arch/i386/kernel/traps.c: die().
You're right, that's where I had it to begin with...I'm not sure how
that happened.
(new patch attached)
Thanks,
--=20
Josh
6B21489A | GnuPG ID/Fingerprint | huber@mclx.com |
61F0 6138 BE7B FEBF A223 E9D1 BFE1 2065 6B21 489A
--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="panic_changes.diff"
Content-Transfer-Encoding: quoted-printable
diff -urN linux-2.4.0-test6-pre8/arch/i386/kernel/traps.c linux-2.4.0-test6=
-pre8-patched/arch/i386/kernel/traps.c
--- linux-2.4.0-test6-pre8/arch/i386/kernel/traps.c Tue Aug 8 15:21:02 2000
+++ linux-2.4.0-test6-pre8-patched/arch/i386/kernel/traps.c Wed Aug 9 08:3=
8:17 2000
@@ -212,6 +212,9 @@
show_registers(regs);
=20
spin_unlock_irq(&die_lock);
+
+ if (panic_on_oops)
+ panic("oops, forcing panic");
do_exit(SIGSEGV);
}
=20
diff -urN linux-2.4.0-test6-pre8/include/linux/kernel.h linux-2.4.0-test6-p=
re8-patched/include/linux/kernel.h
--- linux-2.4.0-test6-pre8/include/linux/kernel.h Tue Jun 20 10:52:36 2000
+++ linux-2.4.0-test6-pre8-patched/include/linux/kernel.h Tue Aug 8 16:46:=
07 2000
@@ -44,7 +44,10 @@
#define FASTCALL(x) x
#endif
=20
+extern int panic_on_oops;
extern struct notifier_block *panic_notifier_list;
+extern int register_panic_notifier(struct notifier_block * nb);
+extern int unregister_panic_notifier(struct notifier_block * nb);
NORET_TYPE void panic(const char * fmt, ...)
__attribute__ ((NORET_AND format (printf, 1, 2)));
NORET_TYPE void do_exit(long error_code)
diff -urN linux-2.4.0-test6-pre8/include/linux/sysctl.h linux-2.4.0-test6-p=
re8-patched/include/linux/sysctl.h
--- linux-2.4.0-test6-pre8/include/linux/sysctl.h Fri Jul 21 17:13:33 2000
+++ linux-2.4.0-test6-pre8-patched/include/linux/sysctl.h Tue Aug 8 16:31:=
44 2000
@@ -113,6 +113,7 @@
KERN_OVERFLOWGID=3D47, /* int: overflow GID */
KERN_SHMPATH=3D48, /* string: path to shm fs */
KERN_HOTPLUG=3D49, /* string: path to hotplug policy agent */
+ KERN_PANIC_ON_OOPS=3D50, /* int: should we panic on an oops? */
};
=20
=20
diff -urN linux-2.4.0-test6-pre8/kernel/panic.c linux-2.4.0-test6-pre8-patc=
hed/kernel/panic.c
--- linux-2.4.0-test6-pre8/kernel/panic.c Tue Jun 20 17:32:27 2000
+++ linux-2.4.0-test6-pre8-patched/kernel/panic.c Tue Aug 8 17:05:26 2000
@@ -21,9 +21,41 @@
extern void unblank_console(void);
=20
int panic_timeout;
+int panic_on_oops =3D 0;
=20
struct notifier_block *panic_notifier_list =3D NULL;
=20
+/**
+ * register_panic_notifier - Register function to be called at panic =
time
+ * @nb: Info about notifier function to be called
+ *
+ * Registers a function with the list of functions
+ * to be called at panic time.
+ *
+ * Currently always returns zero, as notifier_chain_register
+ * always returns zero.
+ */
+
+int register_panic_notifier(struct notifier_block * nb)
+{
+ return notifier_chain_register(&panic_notifier_list, nb);
+}
+
+/**
+ * unregister_panic_notifier - Unregister previously registered panic noti=
fier
+ * @nb: Hook to be unregistered
+ *
+ * Unregisters a previously registered panic
+ * notifier function.
+ *
+ * Returns zero on success, or %-ENOENT on failure.
+ */
+
+int unregister_panic_notifier(struct notifier_block * nb)
+{
+ return notifier_chain_unregister(&panic_notifier_list, nb);
+}
+
static int __init panic_setup(char *str)
{
panic_timeout =3D simple_strtoul(str, NULL, 0);
@@ -46,11 +78,19 @@
NORET_TYPE void panic(const char * fmt, ...)
{
static char buf[1024];
+ static int panicing =3D 0;
va_list args;
#if defined(CONFIG_ARCH_S390)
unsigned long caller =3D (unsigned long) __builtin_return_address(=
0);
#endif
=20
+ if (panicing)
+ goto out;
+
+ panicing =3D 1;
+ unblank_console();
+ notifier_call_chain(&panic_notifier_list, 0, NULL);
+
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
@@ -62,14 +102,11 @@
else
sys_sync();
=20
- unblank_console();
-
#ifdef CONFIG_SMP
smp_send_stop();
#endif
-
- notifier_call_chain(&panic_notifier_list, 0, NULL);
-
+=09
+ out:
if (panic_timeout > 0)
{
/*
@@ -101,3 +138,6 @@
CHECK_EMERGENCY_SYNC
}
}
+
+EXPORT_SYMBOL(register_panic_notifier);
+EXPORT_SYMBOL(unregister_panic_notifier);
diff -urN linux-2.4.0-test6-pre8/kernel/sysctl.c linux-2.4.0-test6-pre8-pat=
ched/kernel/sysctl.c
--- linux-2.4.0-test6-pre8/kernel/sysctl.c Tue Aug 8 15:21:05 2000
+++ linux-2.4.0-test6-pre8-patched/kernel/sysctl.c Tue Aug 8 16:30:20 2000
@@ -230,6 +230,8 @@
{KERN_OVERFLOWGID, "overflowgid", &overflowgid, sizeof(int), 0644, NULL,
&proc_dointvec_minmax, &sysctl_intvec, NULL,
&minolduid, &maxolduid},
+ {KERN_PANIC_ON_OOPS, "panic_on_oops", &panic_on_oops, sizeof(int),
+ 0644, NULL, &proc_dointvec},
{0}
};
=20
--+QahgC5+KEYLbs62--
--TRYliJ5NKNqkz5bu
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjmRUpAACgkQv+EgZWshSJoY5ACgpAz0d8bDO62vccdWLQoeO8kL
DH8Aniv+hrdstCFHM9+8rW6XBdpvNHc1
=g0uZ
-----END PGP SIGNATURE-----
--TRYliJ5NKNqkz5bu--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/