diff options
author | Jes Sorensen <jes@sgi.com> | 2006-02-28 12:42:23 -0500 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-02-28 12:42:23 -0500 |
commit | d2b176ed878d4d5fcc0bd35656dfd373f3702af9 (patch) | |
tree | f5febd7d77fc374ddef9cbe549732bcb3b125c8b /arch/ia64 | |
parent | c8c1635faa7c97329111ce32b927d37306521822 (diff) |
[IA64] sysctl option to silence unaligned trap warnings
Allow sysadmin to disable all warnings about userland apps
making unaligned accesses by using:
# echo 1 > /proc/sys/kernel/ignore-unaligned-usertrap
Rather than having to use prctl on a process by process basis.
Default behaivour leaves the warnings enabled.
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/kernel/unaligned.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c index 112913896844..1e357550c776 100644 --- a/arch/ia64/kernel/unaligned.c +++ b/arch/ia64/kernel/unaligned.c | |||
@@ -53,6 +53,15 @@ dump (const char *str, void *vp, size_t len) | |||
53 | #define SIGN_EXT9 0xffffffffffffff00ul | 53 | #define SIGN_EXT9 0xffffffffffffff00ul |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * sysctl settable hook which tells the kernel whether to honor the | ||
57 | * IA64_THREAD_UAC_NOPRINT prctl. Because this is user settable, we want | ||
58 | * to allow the super user to enable/disable this for security reasons | ||
59 | * (i.e. don't allow attacker to fill up logs with unaligned accesses). | ||
60 | */ | ||
61 | int no_unaligned_warning; | ||
62 | static int noprint_warning; | ||
63 | |||
64 | /* | ||
56 | * For M-unit: | 65 | * For M-unit: |
57 | * | 66 | * |
58 | * opcode | m | x6 | | 67 | * opcode | m | x6 | |
@@ -1324,8 +1333,9 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) | |||
1324 | if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0) | 1333 | if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0) |
1325 | goto force_sigbus; | 1334 | goto force_sigbus; |
1326 | 1335 | ||
1327 | if (!(current->thread.flags & IA64_THREAD_UAC_NOPRINT) | 1336 | if (!no_unaligned_warning && |
1328 | && within_logging_rate_limit()) | 1337 | !(current->thread.flags & IA64_THREAD_UAC_NOPRINT) && |
1338 | within_logging_rate_limit()) | ||
1329 | { | 1339 | { |
1330 | char buf[200]; /* comm[] is at most 16 bytes... */ | 1340 | char buf[200]; /* comm[] is at most 16 bytes... */ |
1331 | size_t len; | 1341 | size_t len; |
@@ -1340,7 +1350,22 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) | |||
1340 | if (user_mode(regs)) | 1350 | if (user_mode(regs)) |
1341 | tty_write_message(current->signal->tty, buf); | 1351 | tty_write_message(current->signal->tty, buf); |
1342 | buf[len-1] = '\0'; /* drop '\r' */ | 1352 | buf[len-1] = '\0'; /* drop '\r' */ |
1343 | printk(KERN_WARNING "%s", buf); /* watch for command names containing %s */ | 1353 | /* watch for command names containing %s */ |
1354 | printk(KERN_WARNING "%s", buf); | ||
1355 | } else { | ||
1356 | if (no_unaligned_warning && !noprint_warning) { | ||
1357 | noprint_warning = 1; | ||
1358 | printk(KERN_WARNING "%s(%d) encountered an " | ||
1359 | "unaligned exception which required\n" | ||
1360 | "kernel assistance, which degrades " | ||
1361 | "the performance of the application.\n" | ||
1362 | "Unaligned exception warnings have " | ||
1363 | "been disabled by the system " | ||
1364 | "administrator\n" | ||
1365 | "echo 0 > /proc/sys/kernel/ignore-" | ||
1366 | "unaligned-usertrap to re-enable\n", | ||
1367 | current->comm, current->pid); | ||
1368 | } | ||
1344 | } | 1369 | } |
1345 | } else { | 1370 | } else { |
1346 | if (within_logging_rate_limit()) | 1371 | if (within_logging_rate_limit()) |