Commit 2ddb3b15 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6:
  parisc: use __ratelimit in unaligned.c
  parisc: Convert to read/update_persistent_clock
  parisc: Simplify param.h by including <asm-generic/param.h>
  parisc: drop unnecessary cast in __ldcw_align() macro
  parisc: add strict copy size checks (v2)
  parisc: remove trailing space in messages
  parisc: ditto sys_accept4
  parisc: wire up sys_recvmmsg
parents 5980bb3e 6ee77658
...@@ -12,4 +12,18 @@ config DEBUG_RODATA ...@@ -12,4 +12,18 @@ config DEBUG_RODATA
portion of the kernel code won't be covered by a TLB anymore. portion of the kernel code won't be covered by a TLB anymore.
If in doubt, say "N". If in doubt, say "N".
config DEBUG_STRICT_USER_COPY_CHECKS
bool "Strict copy size checks"
depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
---help---
Enabling this option turns a certain set of sanity checks for user
copy operations into compile time failures.
The copy_from_user() etc checks are there to help test if there
are sufficient security checks on the length argument of
the copy operation, by having gcc prove that the argument is
within bounds.
If unsure, or if you run an older (pre 4.4) gcc, say N.
endmenu endmenu
#ifndef _ASMPARISC_PARAM_H #include <asm-generic/param.h>
#define _ASMPARISC_PARAM_H
#ifdef __KERNEL__
#define HZ CONFIG_HZ
#define USER_HZ 100 /* some user API use "ticks" */
#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif
#ifndef HZ
#define HZ 100
#endif
#define EXEC_PAGESIZE 4096
#ifndef NOGROUP
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64 /* max length of hostname */
#endif
...@@ -160,7 +160,7 @@ static inline void set_eiem(unsigned long val) ...@@ -160,7 +160,7 @@ static inline void set_eiem(unsigned long val)
ldcd). */ ldcd). */
#define __PA_LDCW_ALIGNMENT 4 #define __PA_LDCW_ALIGNMENT 4
#define __ldcw_align(a) ((volatile unsigned int *)a) #define __ldcw_align(a) (&(a)->slock)
#define __LDCW "ldcw,co" #define __LDCW "ldcw,co"
#endif /*!CONFIG_PA20*/ #endif /*!CONFIG_PA20*/
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <asm/errno.h>
#include <asm-generic/uaccess-unaligned.h> #include <asm-generic/uaccess-unaligned.h>
#define VERIFY_READ 0 #define VERIFY_READ 0
...@@ -234,13 +235,35 @@ extern long lstrnlen_user(const char __user *,long); ...@@ -234,13 +235,35 @@ extern long lstrnlen_user(const char __user *,long);
unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len); unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len);
#define __copy_to_user copy_to_user #define __copy_to_user copy_to_user
unsigned long copy_from_user(void *dst, const void __user *src, unsigned long len); unsigned long __copy_from_user(void *dst, const void __user *src, unsigned long len);
#define __copy_from_user copy_from_user
unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long len); unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long len);
#define __copy_in_user copy_in_user #define __copy_in_user copy_in_user
#define __copy_to_user_inatomic __copy_to_user #define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user #define __copy_from_user_inatomic __copy_from_user
extern void copy_from_user_overflow(void)
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
__compiletime_error("copy_from_user() buffer size is not provably correct")
#else
__compiletime_warning("copy_from_user() buffer size is not provably correct")
#endif
;
static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from,
unsigned long n)
{
int sz = __compiletime_object_size(to);
int ret = -EFAULT;
if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n))
ret = __copy_from_user(to, from, n);
else
copy_from_user_overflow();
return ret;
}
struct pt_regs; struct pt_regs;
int fixup_exception(struct pt_regs *regs); int fixup_exception(struct pt_regs *regs);
......
...@@ -811,8 +811,10 @@ ...@@ -811,8 +811,10 @@
#define __NR_pwritev (__NR_Linux + 316) #define __NR_pwritev (__NR_Linux + 316)
#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317) #define __NR_rt_tgsigqueueinfo (__NR_Linux + 317)
#define __NR_perf_event_open (__NR_Linux + 318) #define __NR_perf_event_open (__NR_Linux + 318)
#define __NR_recvmmsg (__NR_Linux + 319)
#define __NR_accept4 (__NR_Linux + 320)
#define __NR_Linux_syscalls (__NR_perf_event_open + 1) #define __NR_Linux_syscalls (__NR_accept4 + 1)
#define __IGNORE_select /* newselect */ #define __IGNORE_select /* newselect */
......
...@@ -171,14 +171,14 @@ parisc_cache_init(void) ...@@ -171,14 +171,14 @@ parisc_cache_init(void)
cache_info.ic_conf.cc_cst, cache_info.ic_conf.cc_cst,
cache_info.ic_conf.cc_hv); cache_info.ic_conf.cc_hv);
printk("D-TLB conf: sh %d page %d cst %d aid %d pad1 %d \n", printk("D-TLB conf: sh %d page %d cst %d aid %d pad1 %d\n",
cache_info.dt_conf.tc_sh, cache_info.dt_conf.tc_sh,
cache_info.dt_conf.tc_page, cache_info.dt_conf.tc_page,
cache_info.dt_conf.tc_cst, cache_info.dt_conf.tc_cst,
cache_info.dt_conf.tc_aid, cache_info.dt_conf.tc_aid,
cache_info.dt_conf.tc_pad1); cache_info.dt_conf.tc_pad1);
printk("I-TLB conf: sh %d page %d cst %d aid %d pad1 %d \n", printk("I-TLB conf: sh %d page %d cst %d aid %d pad1 %d\n",
cache_info.it_conf.tc_sh, cache_info.it_conf.tc_sh,
cache_info.it_conf.tc_page, cache_info.it_conf.tc_page,
cache_info.it_conf.tc_cst, cache_info.it_conf.tc_cst,
......
...@@ -417,6 +417,8 @@ ...@@ -417,6 +417,8 @@
ENTRY_COMP(pwritev) ENTRY_COMP(pwritev)
ENTRY_COMP(rt_tgsigqueueinfo) ENTRY_COMP(rt_tgsigqueueinfo)
ENTRY_SAME(perf_event_open) ENTRY_SAME(perf_event_open)
ENTRY_COMP(recvmmsg)
ENTRY_SAME(accept4) /* 320 */
/* Nothing yet */ /* Nothing yet */
......
...@@ -250,9 +250,21 @@ static int __init rtc_init(void) ...@@ -250,9 +250,21 @@ static int __init rtc_init(void)
} }
module_init(rtc_init); module_init(rtc_init);
void __init time_init(void) void read_persistent_clock(struct timespec *ts)
{ {
static struct pdc_tod tod_data; static struct pdc_tod tod_data;
if (pdc_tod_read(&tod_data) == 0) {
ts->tv_sec = tod_data.tod_sec;
ts->tv_nsec = tod_data.tod_usec * 1000;
} else {
printk(KERN_ERR "Error reading tod clock\n");
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
}
void __init time_init(void)
{
unsigned long current_cr16_khz; unsigned long current_cr16_khz;
clocktick = (100 * PAGE0->mem_10msec) / HZ; clocktick = (100 * PAGE0->mem_10msec) / HZ;
...@@ -264,19 +276,4 @@ void __init time_init(void) ...@@ -264,19 +276,4 @@ void __init time_init(void)
clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz, clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz,
clocksource_cr16.shift); clocksource_cr16.shift);
clocksource_register(&clocksource_cr16); clocksource_register(&clocksource_cr16);
if (pdc_tod_read(&tod_data) == 0) {
unsigned long flags;
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = tod_data.tod_sec;
xtime.tv_nsec = tod_data.tod_usec * 1000;
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
write_sequnlock_irqrestore(&xtime_lock, flags);
} else {
printk(KERN_ERR "Error reading tod clock\n");
xtime.tv_sec = 0;
xtime.tv_nsec = 0;
}
} }
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/ratelimit.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* #define DEBUG_UNALIGNED 1 */ /* #define DEBUG_UNALIGNED 1 */
...@@ -446,8 +447,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) ...@@ -446,8 +447,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
void handle_unaligned(struct pt_regs *regs) void handle_unaligned(struct pt_regs *regs)
{ {
static unsigned long unaligned_count = 0; static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
static unsigned long last_time = 0;
unsigned long newbase = R1(regs->iir)?regs->gr[R1(regs->iir)]:0; unsigned long newbase = R1(regs->iir)?regs->gr[R1(regs->iir)]:0;
int modify = 0; int modify = 0;
int ret = ERR_NOTHANDLED; int ret = ERR_NOTHANDLED;
...@@ -460,14 +460,8 @@ void handle_unaligned(struct pt_regs *regs) ...@@ -460,14 +460,8 @@ void handle_unaligned(struct pt_regs *regs)
goto force_sigbus; goto force_sigbus;
} }
if (unaligned_count > 5 && if (!(current->thread.flags & PARISC_UAC_NOPRINT) &&
time_after(jiffies, last_time + 5 * HZ)) { __ratelimit(&ratelimit)) {
unaligned_count = 0;
last_time = jiffies;
}
if (!(current->thread.flags & PARISC_UAC_NOPRINT)
&& ++unaligned_count < 5) {
char buf[256]; char buf[256];
sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n",
current->comm, task_pid_nr(current), regs->ior, regs->iaoq[0]); current->comm, task_pid_nr(current), regs->ior, regs->iaoq[0]);
......
...@@ -475,7 +475,8 @@ unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len) ...@@ -475,7 +475,8 @@ unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len)
return pa_memcpy((void __force *)dst, src, len); return pa_memcpy((void __force *)dst, src, len);
} }
unsigned long copy_from_user(void *dst, const void __user *src, unsigned long len) EXPORT_SYMBOL(__copy_from_user);
unsigned long __copy_from_user(void *dst, const void __user *src, unsigned long len)
{ {
mtsp(get_user_space(), 1); mtsp(get_user_space(), 1);
mtsp(get_kernel_space(), 2); mtsp(get_kernel_space(), 2);
......
...@@ -460,7 +460,7 @@ static int init_slot(int slot, struct eeprom_eisa_slot_info *es) ...@@ -460,7 +460,7 @@ static int init_slot(int slot, struct eeprom_eisa_slot_info *es)
slot, id_string); slot, id_string);
print_eisa_id(id_string, es->eisa_slot_id); print_eisa_id(id_string, es->eisa_slot_id);
printk(" expected %s \n", id_string); printk(" expected %s\n", id_string);
return -1; return -1;
......
...@@ -169,7 +169,7 @@ superio_init(struct pci_dev *pcidev) ...@@ -169,7 +169,7 @@ superio_init(struct pci_dev *pcidev)
/* ...then properly fixup the USB to point at suckyio PIC */ /* ...then properly fixup the USB to point at suckyio PIC */
sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev);
printk(KERN_INFO PFX "Found NS87560 Legacy I/O device at %s (IRQ %i) \n", printk(KERN_INFO PFX "Found NS87560 Legacy I/O device at %s (IRQ %i)\n",
pci_name(pdev), pdev->irq); pci_name(pdev), pdev->irq);
pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment