mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[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>
This commit is contained in:
parent
c8c1635faa
commit
d2b176ed87
3 changed files with 43 additions and 3 deletions
|
@ -52,6 +52,15 @@ dump (const char *str, void *vp, size_t len)
|
||||||
#define IA64_FIRST_ROTATING_FR 32
|
#define IA64_FIRST_ROTATING_FR 32
|
||||||
#define SIGN_EXT9 0xffffffffffffff00ul
|
#define SIGN_EXT9 0xffffffffffffff00ul
|
||||||
|
|
||||||
|
/*
|
||||||
|
* sysctl settable hook which tells the kernel whether to honor the
|
||||||
|
* IA64_THREAD_UAC_NOPRINT prctl. Because this is user settable, we want
|
||||||
|
* to allow the super user to enable/disable this for security reasons
|
||||||
|
* (i.e. don't allow attacker to fill up logs with unaligned accesses).
|
||||||
|
*/
|
||||||
|
int no_unaligned_warning;
|
||||||
|
static int noprint_warning;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For M-unit:
|
* For M-unit:
|
||||||
*
|
*
|
||||||
|
@ -1324,8 +1333,9 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
|
||||||
if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0)
|
if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0)
|
||||||
goto force_sigbus;
|
goto force_sigbus;
|
||||||
|
|
||||||
if (!(current->thread.flags & IA64_THREAD_UAC_NOPRINT)
|
if (!no_unaligned_warning &&
|
||||||
&& within_logging_rate_limit())
|
!(current->thread.flags & IA64_THREAD_UAC_NOPRINT) &&
|
||||||
|
within_logging_rate_limit())
|
||||||
{
|
{
|
||||||
char buf[200]; /* comm[] is at most 16 bytes... */
|
char buf[200]; /* comm[] is at most 16 bytes... */
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -1340,7 +1350,22 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
|
||||||
if (user_mode(regs))
|
if (user_mode(regs))
|
||||||
tty_write_message(current->signal->tty, buf);
|
tty_write_message(current->signal->tty, buf);
|
||||||
buf[len-1] = '\0'; /* drop '\r' */
|
buf[len-1] = '\0'; /* drop '\r' */
|
||||||
printk(KERN_WARNING "%s", buf); /* watch for command names containing %s */
|
/* watch for command names containing %s */
|
||||||
|
printk(KERN_WARNING "%s", buf);
|
||||||
|
} else {
|
||||||
|
if (no_unaligned_warning && !noprint_warning) {
|
||||||
|
noprint_warning = 1;
|
||||||
|
printk(KERN_WARNING "%s(%d) encountered an "
|
||||||
|
"unaligned exception which required\n"
|
||||||
|
"kernel assistance, which degrades "
|
||||||
|
"the performance of the application.\n"
|
||||||
|
"Unaligned exception warnings have "
|
||||||
|
"been disabled by the system "
|
||||||
|
"administrator\n"
|
||||||
|
"echo 0 > /proc/sys/kernel/ignore-"
|
||||||
|
"unaligned-usertrap to re-enable\n",
|
||||||
|
current->comm, current->pid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (within_logging_rate_limit())
|
if (within_logging_rate_limit())
|
||||||
|
|
|
@ -147,6 +147,7 @@ enum
|
||||||
KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
|
KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
|
||||||
KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
|
KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
|
||||||
KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
|
KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
|
||||||
|
KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,10 @@ extern int sysctl_hz_timer;
|
||||||
extern int acct_parm[];
|
extern int acct_parm[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_IA64
|
||||||
|
extern int no_unaligned_warning;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
|
static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
|
||||||
ctl_table *, void **);
|
ctl_table *, void **);
|
||||||
static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
|
static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
|
||||||
|
@ -665,6 +669,16 @@ static ctl_table kern_table[] = {
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = &proc_dointvec,
|
.proc_handler = &proc_dointvec,
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_IA64
|
||||||
|
{
|
||||||
|
.ctl_name = KERN_IA64_UNALIGNED,
|
||||||
|
.procname = "ignore-unaligned-usertrap",
|
||||||
|
.data = &no_unaligned_warning,
|
||||||
|
.maxlen = sizeof (int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = &proc_dointvec,
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
{ .ctl_name = 0 }
|
{ .ctl_name = 0 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue