diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 2 | ||||
-rw-r--r-- | kernel/kprobes.c | 36 | ||||
-rw-r--r-- | kernel/module.c | 3 | ||||
-rw-r--r-- | kernel/signal.c | 2 | ||||
-rw-r--r-- | kernel/time.c | 13 |
5 files changed, 29 insertions, 27 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index fe2f71f92ae0..ba42b0a76961 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -641,7 +641,7 @@ static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask) | |||
641 | * task has been modifying its cpuset. | 641 | * task has been modifying its cpuset. |
642 | */ | 642 | */ |
643 | 643 | ||
644 | void cpuset_update_task_memory_state() | 644 | void cpuset_update_task_memory_state(void) |
645 | { | 645 | { |
646 | int my_cpusets_mem_gen; | 646 | int my_cpusets_mem_gen; |
647 | struct task_struct *tsk = current; | 647 | struct task_struct *tsk = current; |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 3ea6325228da..fef1af8a73ce 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -344,23 +344,6 @@ void __kprobes kprobe_flush_task(struct task_struct *tk) | |||
344 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 344 | spin_unlock_irqrestore(&kretprobe_lock, flags); |
345 | } | 345 | } |
346 | 346 | ||
347 | /* | ||
348 | * This kprobe pre_handler is registered with every kretprobe. When probe | ||
349 | * hits it will set up the return probe. | ||
350 | */ | ||
351 | static int __kprobes pre_handler_kretprobe(struct kprobe *p, | ||
352 | struct pt_regs *regs) | ||
353 | { | ||
354 | struct kretprobe *rp = container_of(p, struct kretprobe, kp); | ||
355 | unsigned long flags = 0; | ||
356 | |||
357 | /*TODO: consider to only swap the RA after the last pre_handler fired */ | ||
358 | spin_lock_irqsave(&kretprobe_lock, flags); | ||
359 | arch_prepare_kretprobe(rp, regs); | ||
360 | spin_unlock_irqrestore(&kretprobe_lock, flags); | ||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static inline void free_rp_inst(struct kretprobe *rp) | 347 | static inline void free_rp_inst(struct kretprobe *rp) |
365 | { | 348 | { |
366 | struct kretprobe_instance *ri; | 349 | struct kretprobe_instance *ri; |
@@ -578,6 +561,23 @@ void __kprobes unregister_jprobe(struct jprobe *jp) | |||
578 | 561 | ||
579 | #ifdef ARCH_SUPPORTS_KRETPROBES | 562 | #ifdef ARCH_SUPPORTS_KRETPROBES |
580 | 563 | ||
564 | /* | ||
565 | * This kprobe pre_handler is registered with every kretprobe. When probe | ||
566 | * hits it will set up the return probe. | ||
567 | */ | ||
568 | static int __kprobes pre_handler_kretprobe(struct kprobe *p, | ||
569 | struct pt_regs *regs) | ||
570 | { | ||
571 | struct kretprobe *rp = container_of(p, struct kretprobe, kp); | ||
572 | unsigned long flags = 0; | ||
573 | |||
574 | /*TODO: consider to only swap the RA after the last pre_handler fired */ | ||
575 | spin_lock_irqsave(&kretprobe_lock, flags); | ||
576 | arch_prepare_kretprobe(rp, regs); | ||
577 | spin_unlock_irqrestore(&kretprobe_lock, flags); | ||
578 | return 0; | ||
579 | } | ||
580 | |||
581 | int __kprobes register_kretprobe(struct kretprobe *rp) | 581 | int __kprobes register_kretprobe(struct kretprobe *rp) |
582 | { | 582 | { |
583 | int ret = 0; | 583 | int ret = 0; |
@@ -631,12 +631,12 @@ void __kprobes unregister_kretprobe(struct kretprobe *rp) | |||
631 | unregister_kprobe(&rp->kp); | 631 | unregister_kprobe(&rp->kp); |
632 | /* No race here */ | 632 | /* No race here */ |
633 | spin_lock_irqsave(&kretprobe_lock, flags); | 633 | spin_lock_irqsave(&kretprobe_lock, flags); |
634 | free_rp_inst(rp); | ||
635 | while ((ri = get_used_rp_inst(rp)) != NULL) { | 634 | while ((ri = get_used_rp_inst(rp)) != NULL) { |
636 | ri->rp = NULL; | 635 | ri->rp = NULL; |
637 | hlist_del(&ri->uflist); | 636 | hlist_del(&ri->uflist); |
638 | } | 637 | } |
639 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 638 | spin_unlock_irqrestore(&kretprobe_lock, flags); |
639 | free_rp_inst(rp); | ||
640 | } | 640 | } |
641 | 641 | ||
642 | static int __init init_kprobes(void) | 642 | static int __init init_kprobes(void) |
diff --git a/kernel/module.c b/kernel/module.c index 618ed6e23ecc..e058aedf6b93 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2092,7 +2092,8 @@ static unsigned long mod_find_symname(struct module *mod, const char *name) | |||
2092 | unsigned int i; | 2092 | unsigned int i; |
2093 | 2093 | ||
2094 | for (i = 0; i < mod->num_symtab; i++) | 2094 | for (i = 0; i < mod->num_symtab; i++) |
2095 | if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0) | 2095 | if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 && |
2096 | mod->symtab[i].st_info != 'U') | ||
2096 | return mod->symtab[i].st_value; | 2097 | return mod->symtab[i].st_value; |
2097 | return 0; | 2098 | return 0; |
2098 | } | 2099 | } |
diff --git a/kernel/signal.c b/kernel/signal.c index d3efafd8109a..b373fc2420da 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -283,7 +283,7 @@ static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, | |||
283 | return(q); | 283 | return(q); |
284 | } | 284 | } |
285 | 285 | ||
286 | static inline void __sigqueue_free(struct sigqueue *q) | 286 | static void __sigqueue_free(struct sigqueue *q) |
287 | { | 287 | { |
288 | if (q->flags & SIGQUEUE_PREALLOC) | 288 | if (q->flags & SIGQUEUE_PREALLOC) |
289 | return; | 289 | return; |
diff --git a/kernel/time.c b/kernel/time.c index 1f23e683d6aa..804539165d8b 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -637,15 +637,16 @@ void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) | |||
637 | * | 637 | * |
638 | * Returns the timespec representation of the nsec parameter. | 638 | * Returns the timespec representation of the nsec parameter. |
639 | */ | 639 | */ |
640 | inline struct timespec ns_to_timespec(const nsec_t nsec) | 640 | struct timespec ns_to_timespec(const nsec_t nsec) |
641 | { | 641 | { |
642 | struct timespec ts; | 642 | struct timespec ts; |
643 | 643 | ||
644 | if (nsec) | 644 | if (!nsec) |
645 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, | 645 | return (struct timespec) {0, 0}; |
646 | &ts.tv_nsec); | 646 | |
647 | else | 647 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec); |
648 | ts.tv_sec = ts.tv_nsec = 0; | 648 | if (unlikely(nsec < 0)) |
649 | set_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec); | ||
649 | 650 | ||
650 | return ts; | 651 | return ts; |
651 | } | 652 | } |