···11Linux Magic System Request Key Hacks22-Documentation for sysrq.c version 1.1533-Last update: $Date: 2001/01/28 10:15:59 $22+Documentation for sysrq.c33+Last update: 2007-JAN-064455* What is the magic SysRq key?66~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~···35353636Note that the value of /proc/sys/kernel/sysrq influences only the invocation3737via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always3838-allowed.3838+allowed (by a user with admin privileges).39394040* How do I use the magic SysRq key?4141~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~···5858On other - If you know of the key combos for other architectures, please5959 let me know so I can add them to this section.60606161-On all - write a character to /proc/sysrq-trigger. eg:6161+On all - write a character to /proc/sysrq-trigger. e.g.:62626363 echo t > /proc/sysrq-trigger6464···74747575'c' - Will perform a kexec reboot in order to take a crashdump.76767777+'d' - Shows all locks that are held.7878+7779'o' - Will shut your system off (if configured and supported).78807981's' - Will attempt to sync all mounted filesystems.···89879088'm' - Will dump current memory info to your console.91899090+'n' - Used to make RT tasks nice-able9191+9292'v' - Dumps Voyager SMP processor info to your console.9393+9494+'w' - Dumps tasks that are in uninterruptable (blocked) state.9595+9696+'x' - Used by xmon interface on ppc/powerpc platforms.93979498'0'-'9' - Sets the console log level, controlling which kernel messages9599 will be printed to your console. ('0', for example would make96100 it so that only emergency messages like PANICs or OOPSes would97101 make it to your console.)981029999-'f' - Will call oom_kill to kill a memory hog process103103+'f' - Will call oom_kill to kill a memory hog process.100104101105'e' - Send a SIGTERM to all processes, except for init.102106107107+'g' - Used by kgdb on ppc platforms.108108+103109'i' - Send a SIGKILL to all processes, except for init.104110105105-'l' - Send a SIGKILL to all processes, INCLUDING init. (Your system106106- will be non-functional after this.)107107-108108-'h' - Will display help ( actually any other key than those listed111111+'h' - Will display help (actually any other key than those listed109112 above will display help. but 'h' is easy to remember :-)110113111114* Okay, so what can I use them for?112115~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~113116Well, un'R'aw is very handy when your X server or a svgalib program crashes.114117115115-sa'K' (Secure Access Key) is useful when you want to be sure there are no116116-trojan program is running at console and which could grab your password117117-when you would try to login. It will kill all programs on given console118118-and thus letting you make sure that the login prompt you see is actually118118+sa'K' (Secure Access Key) is useful when you want to be sure there is no119119+trojan program running at console which could grab your password120120+when you would try to login. It will kill all programs on given console,121121+thus letting you make sure that the login prompt you see is actually119122the one from init, not some trojan program.120123IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT121124IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT122125IMPORTANT: such. :IMPORTANT123123- It seems other find it useful as (System Attention Key) which is126126+ It seems others find it useful as (System Attention Key) which is124127useful when you want to exit a program that will not let you switch consoles.125128(For example, X or a svgalib program.)126129···146139Again, the unmount (remount read-only) hasn't taken place until you see the147140"OK" and "Done" message appear on the screen.148141149149-The loglevel'0'-'9' is useful when your console is being flooded with150150-kernel messages you do not want to see. Setting '0' will prevent all but142142+The loglevels '0'-'9' are useful when your console is being flooded with143143+kernel messages you do not want to see. Selecting '0' will prevent all but151144the most urgent kernel messages from reaching your console. (They will152145still be logged if syslogd/klogd are alive, though.)153146···159152~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~160153That happens to me, also. I've found that tapping shift, alt, and control161154on both sides of the keyboard, and hitting an invalid sysrq sequence again162162-will fix the problem. (ie, something like alt-sysrq-z). Switching to another155155+will fix the problem. (i.e., something like alt-sysrq-z). Switching to another163156virtual console (ALT+Fn) and then back again should also help.164157165158* I hit SysRq, but nothing seems to happen, what's wrong?···181174prints help, and C) an action_msg string, that will print right before your182175handler is called. Your handler must conform to the prototype in 'sysrq.h'.183176184184-After the sysrq_key_op is created, you can call the macro 185185-register_sysrq_key(int key, struct sysrq_key_op *op_p) that is defined in186186-sysrq.h, this will register the operation pointed to by 'op_p' at table187187-key 'key', if that slot in the table is blank. At module unload time, you must188188-call the macro unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which177177+After the sysrq_key_op is created, you can call the kernel function178178+register_sysrq_key(int key, struct sysrq_key_op *op_p); this will179179+register the operation pointed to by 'op_p' at table key 'key',180180+if that slot in the table is blank. At module unload time, you must call181181+the function unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which189182will remove the key op pointed to by 'op_p' from the key 'key', if and only if190183it is currently registered in that slot. This is in case the slot has been191184overwritten since you registered it.···193186The Magic SysRQ system works by registering key operations against a key op194187lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has195188a number of operations registered into it at compile time, but is mutable,196196-and 4 functions are exported for interface to it: __sysrq_lock_table,197197-__sysrq_unlock_table, __sysrq_get_key_op, and __sysrq_put_key_op. The198198-functions __sysrq_swap_key_ops and __sysrq_swap_key_ops_nolock are defined199199-in the header itself, and the REGISTER and UNREGISTER macros are built from200200-these. More complex (and dangerous!) manipulations of the table are possible201201-using these functions, but you must be careful to always lock the table before202202-you read or write from it, and to unlock it again when you are done. (And of203203-course, to never ever leave an invalid pointer in the table). Null pointers in204204-the table are always safe :)189189+and 2 functions are exported for interface to it:190190+ register_sysrq_key and unregister_sysrq_key.191191+Of course, never ever leave an invalid pointer in the table. I.e., when192192+your module that called register_sysrq_key() exits, it must call193193+unregister_sysrq_key() to clean up the sysrq key table entry that it used.194194+Null pointers in the table are always safe. :)205195206196If for some reason you feel the need to call the handle_sysrq function from207197within a function called by handle_sysrq, you must be aware that you are in
···4343 /* Match found */4444 return 1;4545 }4646+ if (strncmp(sym_name, "__crc_", 6) == 0)4747+ return 1;4648 return 0;4749}4850
+1-1
arch/i386/mach-default/setup.c
···102102 * along the MCA bus. Use this to hook into that chain if you will need103103 * it.104104 **/105105-void __init mca_nmi_hook(void)105105+void mca_nmi_hook(void)106106{107107 /* If I recall correctly, there's a whole bunch of other things that108108 * we can do to check for NMI problems, but that's all I know about
+4-4
arch/sparc/kernel/smp.c
···292292293293void __init smp_prepare_cpus(unsigned int max_cpus)294294{295295- extern void smp4m_boot_cpus(void);296296- extern void smp4d_boot_cpus(void);295295+ extern void __init smp4m_boot_cpus(void);296296+ extern void __init smp4d_boot_cpus(void);297297 int i, cpuid, extra;298298299299 printk("Entering SMP Mode...\n");···375375376376int __cpuinit __cpu_up(unsigned int cpu)377377{378378- extern int smp4m_boot_one_cpu(int);379379- extern int smp4d_boot_one_cpu(int);378378+ extern int __cpuinit smp4m_boot_one_cpu(int);379379+ extern int __cpuinit smp4d_boot_one_cpu(int);380380 int ret=0;381381382382 switch(sparc_cpu_model) {
+1-1
arch/sparc/kernel/sun4d_smp.c
···164164 local_flush_cache_all();165165}166166167167-int smp4d_boot_one_cpu(int i)167167+int __cpuinit smp4d_boot_one_cpu(int i)168168{169169 extern unsigned long sun4d_cpu_startup;170170 unsigned long *entry = &sun4d_cpu_startup;
+11-9
drivers/char/sysrq.c
···215215}216216static struct sysrq_key_op sysrq_showstate_blocked_op = {217217 .handler = sysrq_handle_showstate_blocked,218218- .help_msg = "showBlockedTasks",218218+ .help_msg = "shoW-blocked-tasks",219219 .action_msg = "Show Blocked State",220220 .enable_mask = SYSRQ_ENABLE_DUMP,221221};···315315 &sysrq_loglevel_op, /* 9 */316316317317 /*318318- * Don't use for system provided sysrqs, it is handled specially on319319- * sparc and will never arrive318318+ * a: Don't use for system provided sysrqs, it is handled specially on319319+ * sparc and will never arrive.320320 */321321 NULL, /* a */322322 &sysrq_reboot_op, /* b */323323- &sysrq_crashdump_op, /* c */323323+ &sysrq_crashdump_op, /* c & ibm_emac driver debug */324324 &sysrq_showlocks_op, /* d */325325 &sysrq_term_op, /* e */326326 &sysrq_moom_op, /* f */327327+ /* g: May be registered by ppc for kgdb */327328 NULL, /* g */328329 NULL, /* h */329330 &sysrq_kill_op, /* i */···333332 NULL, /* l */334333 &sysrq_showmem_op, /* m */335334 &sysrq_unrt_op, /* n */336336- /* This will often be registered as 'Off' at init time */335335+ /* o: This will often be registered as 'Off' at init time */337336 NULL, /* o */338337 &sysrq_showregs_op, /* p */339338 NULL, /* q */340340- &sysrq_unraw_op, /* r */339339+ &sysrq_unraw_op, /* r */341340 &sysrq_sync_op, /* s */342341 &sysrq_showstate_op, /* t */343342 &sysrq_mountro_op, /* u */344344- /* May be assigned at init time by SMP VOYAGER */343343+ /* v: May be registered at init time by SMP VOYAGER */345344 NULL, /* v */346346- NULL, /* w */347347- &sysrq_showstate_blocked_op, /* x */345345+ &sysrq_showstate_blocked_op, /* w */346346+ /* x: May be registered on ppc/powerpc for xmon */347347+ NULL, /* x */348348 NULL, /* y */349349 NULL /* z */350350};
···1116111611171117 if (rdmsr_safe(index, &data_low, &data_high) < 0)11181118 continue;11191119+ if (wrmsr_safe(index, data_low, data_high) < 0)11201120+ continue;11191121 data = data_low | ((u64)data_high << 32);11201122 vcpu->host_msrs[j].index = index;11211123 vcpu->host_msrs[j].reserved = 0;
+3-3
drivers/net/hamradio/Kconfig
···113113114114config BAYCOM_SER_FDX115115 tristate "BAYCOM ser12 fullduplex driver for AX.25"116116- depends on AX25116116+ depends on AX25 && !S390117117 select CRC_CCITT118118 ---help---119119 This is one of two drivers for Baycom style simple amateur radio···133133134134config BAYCOM_SER_HDX135135 tristate "BAYCOM ser12 halfduplex driver for AX.25"136136- depends on AX25136136+ depends on AX25 && !S390137137 select CRC_CCITT138138 ---help---139139 This is one of two drivers for Baycom style simple amateur radio···181181182182config YAM183183 tristate "YAM driver for AX.25"184184- depends on AX25184184+ depends on AX25 && !S390185185 help186186 The YAM is a modem for packet radio which connects to the serial187187 port and includes some of the functions of a Terminal Node
+5-3
drivers/pci/quirks.c
···661661 /* See what bridge we have and find the device ranges */662662 switch (dev->device) {663663 case PCI_DEVICE_ID_VIA_82C686:664664- /* 82C686 is special */665665- via_vlink_dev_lo = 7;666666- via_vlink_dev_hi = 7;664664+ /* The VT82C686 is special, it attaches to PCI and can have665665+ any device number. All its subdevices are functions of666666+ that single device. */667667+ via_vlink_dev_lo = PCI_SLOT(dev->devfn);668668+ via_vlink_dev_hi = PCI_SLOT(dev->devfn);667669 break;668670 case PCI_DEVICE_ID_VIA_8237:669671 case PCI_DEVICE_ID_VIA_8237A:
+2-8
drivers/pci/search.c
···200200 * can cause some machines to crash. So here we detect and flag that201201 * situation and bail out early.202202 */203203- if (unlikely(list_empty(&pci_devices))) {204204- printk(KERN_INFO "pci_find_subsys() called while pci_devices "205205- "is still empty\n");203203+ if (unlikely(list_empty(&pci_devices)))206204 return NULL;207207- }208205 down_read(&pci_bus_sem);209206 n = from ? from->global_list.next : pci_devices.next;210207···275278 * can cause some machines to crash. So here we detect and flag that276279 * situation and bail out early.277280 */278278- if (unlikely(list_empty(&pci_devices))) {279279- printk(KERN_NOTICE "pci_get_subsys() called while pci_devices "280280- "is still empty\n");281281+ if (unlikely(list_empty(&pci_devices)))281282 return NULL;282282- }283283 down_read(&pci_bus_sem);284284 n = from ? from->global_list.next : pci_devices.next;285285
···408408409409#include <asm-generic/pgtable-nopud.h>410410411411+#ifdef CONFIG_HIGHMEM412412+/* Clear a kernel PTE and flush it from the TLB */413413+#define kpte_clear_flush(ptep, vaddr) \414414+do { \415415+ pte_clear(&init_mm, vaddr, ptep); \416416+ __flush_tlb_one(vaddr); \417417+} while (0)418418+#endif419419+411420#endif412421#endif413422
+1-1
include/linux/efi.h
···301301extern void efi_initialize_iomem_resources(struct resource *code_resource,302302 struct resource *data_resource);303303extern unsigned long efi_get_time(void);304304-extern int __init efi_set_rtc_mmss(unsigned long nowtime);304304+extern int efi_set_rtc_mmss(unsigned long nowtime);305305extern int is_available_memory(efi_memory_desc_t * md);306306extern struct efi_memory_map memmap;307307
···989989 int classzone_idx, int alloc_flags)990990{991991 /* free_pages my go negative - that's OK */992992- unsigned long min = mark;993993- long free_pages = z->free_pages - (1 << order) + 1;992992+ long min = mark, free_pages = z->free_pages - (1 << order) + 1;994993 int o;995994996995 if (alloc_flags & ALLOC_HIGH)
+8-2
net/ipv4/netfilter/ip_conntrack_sip.c
···283283{284284 int s = *shift;285285286286- for (; dptr <= limit && *dptr != '@'; dptr++)286286+ /* Search for @, but stop at the end of the line.287287+ * We are inside a sip: URI, so we don't need to worry about288288+ * continuation lines. */289289+ while (dptr <= limit &&290290+ *dptr != '@' && *dptr != '\r' && *dptr != '\n') {287291 (*shift)++;292292+ dptr++;293293+ }288294289289- if (*dptr == '@') {295295+ if (dptr <= limit && *dptr == '@') {290296 dptr++;291297 (*shift)++;292298 } else
···14131413 return;14141414 }1415141514161416+ if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) &&14171417+ !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {14181418+ ND_PRINTK2(KERN_WARNING14191419+ "ICMPv6 Redirect: target address is not link-local.\n");14201420+ return;14211421+ }14221422+14161423 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr,14171424 dev->ifindex);14181425
+1-1
net/netfilter/Kconfig
···628628629629config NETFILTER_XT_MATCH_HASHLIMIT630630 tristate '"hashlimit" match support'631631- depends on NETFILTER_XTABLES631631+ depends on NETFILTER_XTABLES && (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n)632632 help633633 This option adds a `hashlimit' match.634634
+8-2
net/netfilter/nf_conntrack_sip.c
···303303{304304 int s = *shift;305305306306- for (; dptr <= limit && *dptr != '@'; dptr++)306306+ /* Search for @, but stop at the end of the line.307307+ * We are inside a sip: URI, so we don't need to worry about308308+ * continuation lines. */309309+ while (dptr <= limit &&310310+ *dptr != '@' && *dptr != '\r' && *dptr != '\n') {307311 (*shift)++;312312+ dptr++;313313+ }308314309309- if (*dptr == '@') {315315+ if (dptr <= limit && *dptr == '@') {310316 dptr++;311317 (*shift)++;312318 } else
+12-17
net/netfilter/xt_connbytes.c
···5252{5353 const struct xt_connbytes_info *sinfo = matchinfo;5454 u_int64_t what = 0; /* initialize to make gcc happy */5555+ u_int64_t bytes = 0;5656+ u_int64_t pkts = 0;5557 const struct ip_conntrack_counter *counters;56585759 if (!(counters = nf_ct_get_counters(skb)))···9189 case XT_CONNBYTES_AVGPKT:9290 switch (sinfo->direction) {9391 case XT_CONNBYTES_DIR_ORIGINAL:9494- what = div64_64(counters[IP_CT_DIR_ORIGINAL].bytes,9595- counters[IP_CT_DIR_ORIGINAL].packets);9292+ bytes = counters[IP_CT_DIR_ORIGINAL].bytes;9393+ pkts = counters[IP_CT_DIR_ORIGINAL].packets;9694 break;9795 case XT_CONNBYTES_DIR_REPLY:9898- what = div64_64(counters[IP_CT_DIR_REPLY].bytes,9999- counters[IP_CT_DIR_REPLY].packets);9696+ bytes = counters[IP_CT_DIR_REPLY].bytes;9797+ pkts = counters[IP_CT_DIR_REPLY].packets;10098 break;10199 case XT_CONNBYTES_DIR_BOTH:102102- {103103- u_int64_t bytes;104104- u_int64_t pkts;105105- bytes = counters[IP_CT_DIR_ORIGINAL].bytes +106106- counters[IP_CT_DIR_REPLY].bytes;107107- pkts = counters[IP_CT_DIR_ORIGINAL].packets+108108- counters[IP_CT_DIR_REPLY].packets;109109-110110- /* FIXME_THEORETICAL: what to do if sum111111- * overflows ? */112112-113113- what = div64_64(bytes, pkts);114114- }100100+ bytes = counters[IP_CT_DIR_ORIGINAL].bytes +101101+ counters[IP_CT_DIR_REPLY].bytes;102102+ pkts = counters[IP_CT_DIR_ORIGINAL].packets +103103+ counters[IP_CT_DIR_REPLY].packets;115104 break;116105 }106106+ if (pkts != 0)107107+ what = div64_64(bytes, pkts);117108 break;118109 }119110
+6
net/sctp/sm_sideeffect.c
···621621 /* The receiver of the HEARTBEAT ACK should also perform an622622 * RTT measurement for that destination transport address623623 * using the time value carried in the HEARTBEAT ACK chunk.624624+ * If the transport's rto_pending variable has been cleared,625625+ * it was most likely due to a retransmit. However, we want626626+ * to re-enable it to properly update the rto.624627 */628628+ if (t->rto_pending == 0)629629+ t->rto_pending = 1;630630+625631 hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;626632 sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));627633