diff -urNp linux-260/arch/ia64/kernel/unaligned.c linux-262/arch/ia64/kernel/unaligned.c --- linux-260/arch/ia64/kernel/unaligned.c +++ linux-262/arch/ia64/kernel/unaligned.c @@ -51,6 +51,14 @@ dump (const char *str, void *vp, size_t #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 honor_uac_noprint = 0; + +/* * For M-unit: * * opcode | m | x6 | @@ -1331,7 +1339,8 @@ ia64_handle_unaligned (unsigned long ifa if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0) goto force_sigbus; - if (!(current->thread.flags & IA64_THREAD_UAC_NOPRINT) + if (honor_uac_noprint && + !(current->thread.flags & IA64_THREAD_UAC_NOPRINT) && within_logging_rate_limit()) { char buf[200]; /* comm[] is at most 16 bytes... */ @@ -1340,12 +1349,6 @@ ia64_handle_unaligned (unsigned long ifa len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, " "ip=0x%016lx\n\r", current->comm, current->pid, ifa, regs->cr_iip + ipsr->ri); - /* - * Don't call tty_write_message() if we're in the kernel; we might - * be holding locks... - */ - if (user_mode(regs)) - tty_write_message(current->tty, buf); buf[len-1] = '\0'; /* drop '\r' */ printk(KERN_WARNING "%s", buf); /* watch for command names containing %s */ } diff -urNp linux-260/include/linux/sysctl.h linux-262/include/linux/sysctl.h --- linux-260/include/linux/sysctl.h +++ linux-262/include/linux/sysctl.h @@ -127,6 +127,7 @@ enum KERN_PID_MAX=55, /* int: max PID value of processes */ KERN_CORE_PATTERN=56, /* string: pattern for core-files */ KERN_CORE_SETUID=58, /* int: set to allow core dumps of setuid apps */ + KERN_HONOR_UAC_NOPRINT=61, /* int: allow access to UAC_NOPRINT prctl */ }; diff -urNp linux-260/kernel/sysctl.c linux-262/kernel/sysctl.c --- linux-260/kernel/sysctl.c +++ linux-262/kernel/sysctl.c @@ -95,6 +95,10 @@ extern int sysctl_ieee_emulation_warning extern int sysctl_userprocess_debug; #endif +#ifdef CONFIG_IA64 +extern int honor_uac_noprint; +#endif + #ifdef CONFIG_PPC32 extern unsigned long zero_paged_on, powersave_nap; int proc_dol2crvec(ctl_table *table, int write, struct file *filp, @@ -279,6 +283,10 @@ static ctl_table kern_table[] = { {KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug", &sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec}, #endif +#ifdef CONFIG_IA64 + {KERN_HONOR_UAC_NOPRINT, "honor_uac_noprint_prctl", &honor_uac_noprint, + sizeof(int), 0644, NULL, &proc_dointvec}, +#endif {0} };