diff options
author | David S. Miller <davem@davemloft.net> | 2015-03-03 21:16:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-03 21:16:48 -0500 |
commit | 71a83a6db6138b9d41d8a0b6b91cb59f6dc4742c (patch) | |
tree | f74b6e4e48257ec6ce40b95645ecb8533b9cc1f8 /kernel | |
parent | b97526f3ff95f92b107f0fb52cbb8627e395429b (diff) | |
parent | a6c5170d1edea97c538c81e377e56c7b5c5b7e63 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/rocker/rocker.c
The rocker commit was two overlapping changes, one to rename
the ->vport member to ->pport, and another making the bitmask
expression use '1ULL' instead of plain '1'.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/debug/debug_core.c | 19 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_io.c | 46 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_main.c | 16 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_private.h | 4 | ||||
-rw-r--r-- | kernel/gcov/Makefile | 36 | ||||
-rw-r--r-- | kernel/livepatch/core.c | 10 | ||||
-rw-r--r-- | kernel/locking/rtmutex.c | 4 | ||||
-rw-r--r-- | kernel/printk/printk.c | 2 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 1 | ||||
-rw-r--r-- | kernel/sched/auto_group.c | 6 | ||||
-rw-r--r-- | kernel/sched/completion.c | 19 | ||||
-rw-r--r-- | kernel/sched/core.c | 113 | ||||
-rw-r--r-- | kernel/sched/deadline.c | 33 | ||||
-rw-r--r-- | kernel/sched/sched.h | 76 | ||||
-rw-r--r-- | kernel/sys.c | 15 | ||||
-rw-r--r-- | kernel/time/ntp.c | 10 |
16 files changed, 247 insertions, 163 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 07ce18ca71e0..0874e2edd275 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
@@ -604,7 +604,7 @@ return_normal: | |||
604 | online_cpus) | 604 | online_cpus) |
605 | cpu_relax(); | 605 | cpu_relax(); |
606 | if (!time_left) | 606 | if (!time_left) |
607 | pr_crit("KGDB: Timed out waiting for secondary CPUs.\n"); | 607 | pr_crit("Timed out waiting for secondary CPUs.\n"); |
608 | 608 | ||
609 | /* | 609 | /* |
610 | * At this point the primary processor is completely | 610 | * At this point the primary processor is completely |
@@ -696,6 +696,14 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) | |||
696 | 696 | ||
697 | if (arch_kgdb_ops.enable_nmi) | 697 | if (arch_kgdb_ops.enable_nmi) |
698 | arch_kgdb_ops.enable_nmi(0); | 698 | arch_kgdb_ops.enable_nmi(0); |
699 | /* | ||
700 | * Avoid entering the debugger if we were triggered due to an oops | ||
701 | * but panic_timeout indicates the system should automatically | ||
702 | * reboot on panic. We don't want to get stuck waiting for input | ||
703 | * on such systems, especially if its "just" an oops. | ||
704 | */ | ||
705 | if (signo != SIGTRAP && panic_timeout) | ||
706 | return 1; | ||
699 | 707 | ||
700 | memset(ks, 0, sizeof(struct kgdb_state)); | 708 | memset(ks, 0, sizeof(struct kgdb_state)); |
701 | ks->cpu = raw_smp_processor_id(); | 709 | ks->cpu = raw_smp_processor_id(); |
@@ -828,6 +836,15 @@ static int kgdb_panic_event(struct notifier_block *self, | |||
828 | unsigned long val, | 836 | unsigned long val, |
829 | void *data) | 837 | void *data) |
830 | { | 838 | { |
839 | /* | ||
840 | * Avoid entering the debugger if we were triggered due to a panic | ||
841 | * We don't want to get stuck waiting for input from user in such case. | ||
842 | * panic_timeout indicates the system should automatically | ||
843 | * reboot on panic. | ||
844 | */ | ||
845 | if (panic_timeout) | ||
846 | return NOTIFY_DONE; | ||
847 | |||
831 | if (dbg_kdb_mode) | 848 | if (dbg_kdb_mode) |
832 | kdb_printf("PANIC: %s\n", (char *)data); | 849 | kdb_printf("PANIC: %s\n", (char *)data); |
833 | kgdb_breakpoint(); | 850 | kgdb_breakpoint(); |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 7c70812caea5..fc1ef736253c 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
@@ -439,7 +439,7 @@ poll_again: | |||
439 | * substituted for %d, %x or %o in the prompt. | 439 | * substituted for %d, %x or %o in the prompt. |
440 | */ | 440 | */ |
441 | 441 | ||
442 | char *kdb_getstr(char *buffer, size_t bufsize, char *prompt) | 442 | char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt) |
443 | { | 443 | { |
444 | if (prompt && kdb_prompt_str != prompt) | 444 | if (prompt && kdb_prompt_str != prompt) |
445 | strncpy(kdb_prompt_str, prompt, CMD_BUFLEN); | 445 | strncpy(kdb_prompt_str, prompt, CMD_BUFLEN); |
@@ -548,7 +548,7 @@ static int kdb_search_string(char *searched, char *searchfor) | |||
548 | return 0; | 548 | return 0; |
549 | } | 549 | } |
550 | 550 | ||
551 | int vkdb_printf(const char *fmt, va_list ap) | 551 | int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap) |
552 | { | 552 | { |
553 | int diag; | 553 | int diag; |
554 | int linecount; | 554 | int linecount; |
@@ -680,6 +680,12 @@ int vkdb_printf(const char *fmt, va_list ap) | |||
680 | size_avail = sizeof(kdb_buffer) - len; | 680 | size_avail = sizeof(kdb_buffer) - len; |
681 | goto kdb_print_out; | 681 | goto kdb_print_out; |
682 | } | 682 | } |
683 | if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) | ||
684 | /* | ||
685 | * This was a interactive search (using '/' at more | ||
686 | * prompt) and it has completed. Clear the flag. | ||
687 | */ | ||
688 | kdb_grepping_flag = 0; | ||
683 | /* | 689 | /* |
684 | * at this point the string is a full line and | 690 | * at this point the string is a full line and |
685 | * should be printed, up to the null. | 691 | * should be printed, up to the null. |
@@ -691,19 +697,20 @@ kdb_printit: | |||
691 | * Write to all consoles. | 697 | * Write to all consoles. |
692 | */ | 698 | */ |
693 | retlen = strlen(kdb_buffer); | 699 | retlen = strlen(kdb_buffer); |
700 | cp = (char *) printk_skip_level(kdb_buffer); | ||
694 | if (!dbg_kdb_mode && kgdb_connected) { | 701 | if (!dbg_kdb_mode && kgdb_connected) { |
695 | gdbstub_msg_write(kdb_buffer, retlen); | 702 | gdbstub_msg_write(cp, retlen - (cp - kdb_buffer)); |
696 | } else { | 703 | } else { |
697 | if (dbg_io_ops && !dbg_io_ops->is_console) { | 704 | if (dbg_io_ops && !dbg_io_ops->is_console) { |
698 | len = retlen; | 705 | len = retlen - (cp - kdb_buffer); |
699 | cp = kdb_buffer; | 706 | cp2 = cp; |
700 | while (len--) { | 707 | while (len--) { |
701 | dbg_io_ops->write_char(*cp); | 708 | dbg_io_ops->write_char(*cp2); |
702 | cp++; | 709 | cp2++; |
703 | } | 710 | } |
704 | } | 711 | } |
705 | while (c) { | 712 | while (c) { |
706 | c->write(c, kdb_buffer, retlen); | 713 | c->write(c, cp, retlen - (cp - kdb_buffer)); |
707 | touch_nmi_watchdog(); | 714 | touch_nmi_watchdog(); |
708 | c = c->next; | 715 | c = c->next; |
709 | } | 716 | } |
@@ -711,7 +718,10 @@ kdb_printit: | |||
711 | if (logging) { | 718 | if (logging) { |
712 | saved_loglevel = console_loglevel; | 719 | saved_loglevel = console_loglevel; |
713 | console_loglevel = CONSOLE_LOGLEVEL_SILENT; | 720 | console_loglevel = CONSOLE_LOGLEVEL_SILENT; |
714 | printk(KERN_INFO "%s", kdb_buffer); | 721 | if (printk_get_level(kdb_buffer) || src == KDB_MSGSRC_PRINTK) |
722 | printk("%s", kdb_buffer); | ||
723 | else | ||
724 | pr_info("%s", kdb_buffer); | ||
715 | } | 725 | } |
716 | 726 | ||
717 | if (KDB_STATE(PAGER)) { | 727 | if (KDB_STATE(PAGER)) { |
@@ -794,11 +804,23 @@ kdb_printit: | |||
794 | kdb_nextline = linecount - 1; | 804 | kdb_nextline = linecount - 1; |
795 | kdb_printf("\r"); | 805 | kdb_printf("\r"); |
796 | suspend_grep = 1; /* for this recursion */ | 806 | suspend_grep = 1; /* for this recursion */ |
807 | } else if (buf1[0] == '/' && !kdb_grepping_flag) { | ||
808 | kdb_printf("\r"); | ||
809 | kdb_getstr(kdb_grep_string, KDB_GREP_STRLEN, | ||
810 | kdbgetenv("SEARCHPROMPT") ?: "search> "); | ||
811 | *strchrnul(kdb_grep_string, '\n') = '\0'; | ||
812 | kdb_grepping_flag += KDB_GREPPING_FLAG_SEARCH; | ||
813 | suspend_grep = 1; /* for this recursion */ | ||
797 | } else if (buf1[0] && buf1[0] != '\n') { | 814 | } else if (buf1[0] && buf1[0] != '\n') { |
798 | /* user hit something other than enter */ | 815 | /* user hit something other than enter */ |
799 | suspend_grep = 1; /* for this recursion */ | 816 | suspend_grep = 1; /* for this recursion */ |
800 | kdb_printf("\nOnly 'q' or 'Q' are processed at more " | 817 | if (buf1[0] != '/') |
801 | "prompt, input ignored\n"); | 818 | kdb_printf( |
819 | "\nOnly 'q', 'Q' or '/' are processed at " | ||
820 | "more prompt, input ignored\n"); | ||
821 | else | ||
822 | kdb_printf("\n'/' cannot be used during | " | ||
823 | "grep filtering, input ignored\n"); | ||
802 | } else if (kdb_grepping_flag) { | 824 | } else if (kdb_grepping_flag) { |
803 | /* user hit enter */ | 825 | /* user hit enter */ |
804 | suspend_grep = 1; /* for this recursion */ | 826 | suspend_grep = 1; /* for this recursion */ |
@@ -844,7 +866,7 @@ int kdb_printf(const char *fmt, ...) | |||
844 | int r; | 866 | int r; |
845 | 867 | ||
846 | va_start(ap, fmt); | 868 | va_start(ap, fmt); |
847 | r = vkdb_printf(fmt, ap); | 869 | r = vkdb_printf(KDB_MSGSRC_INTERNAL, fmt, ap); |
848 | va_end(ap); | 870 | va_end(ap); |
849 | 871 | ||
850 | return r; | 872 | return r; |
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 7b40c5f07dce..4121345498e0 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c | |||
@@ -50,8 +50,7 @@ | |||
50 | static int kdb_cmd_enabled = CONFIG_KDB_DEFAULT_ENABLE; | 50 | static int kdb_cmd_enabled = CONFIG_KDB_DEFAULT_ENABLE; |
51 | module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600); | 51 | module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600); |
52 | 52 | ||
53 | #define GREP_LEN 256 | 53 | char kdb_grep_string[KDB_GREP_STRLEN]; |
54 | char kdb_grep_string[GREP_LEN]; | ||
55 | int kdb_grepping_flag; | 54 | int kdb_grepping_flag; |
56 | EXPORT_SYMBOL(kdb_grepping_flag); | 55 | EXPORT_SYMBOL(kdb_grepping_flag); |
57 | int kdb_grep_leading; | 56 | int kdb_grep_leading; |
@@ -870,7 +869,7 @@ static void parse_grep(const char *str) | |||
870 | len = strlen(cp); | 869 | len = strlen(cp); |
871 | if (!len) | 870 | if (!len) |
872 | return; | 871 | return; |
873 | if (len >= GREP_LEN) { | 872 | if (len >= KDB_GREP_STRLEN) { |
874 | kdb_printf("search string too long\n"); | 873 | kdb_printf("search string too long\n"); |
875 | return; | 874 | return; |
876 | } | 875 | } |
@@ -915,13 +914,12 @@ int kdb_parse(const char *cmdstr) | |||
915 | char *cp; | 914 | char *cp; |
916 | char *cpp, quoted; | 915 | char *cpp, quoted; |
917 | kdbtab_t *tp; | 916 | kdbtab_t *tp; |
918 | int i, escaped, ignore_errors = 0, check_grep; | 917 | int i, escaped, ignore_errors = 0, check_grep = 0; |
919 | 918 | ||
920 | /* | 919 | /* |
921 | * First tokenize the command string. | 920 | * First tokenize the command string. |
922 | */ | 921 | */ |
923 | cp = (char *)cmdstr; | 922 | cp = (char *)cmdstr; |
924 | kdb_grepping_flag = check_grep = 0; | ||
925 | 923 | ||
926 | if (KDB_FLAG(CMD_INTERRUPT)) { | 924 | if (KDB_FLAG(CMD_INTERRUPT)) { |
927 | /* Previous command was interrupted, newline must not | 925 | /* Previous command was interrupted, newline must not |
@@ -1247,7 +1245,6 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, | |||
1247 | kdb_printf("due to NonMaskable Interrupt @ " | 1245 | kdb_printf("due to NonMaskable Interrupt @ " |
1248 | kdb_machreg_fmt "\n", | 1246 | kdb_machreg_fmt "\n", |
1249 | instruction_pointer(regs)); | 1247 | instruction_pointer(regs)); |
1250 | kdb_dumpregs(regs); | ||
1251 | break; | 1248 | break; |
1252 | case KDB_REASON_SSTEP: | 1249 | case KDB_REASON_SSTEP: |
1253 | case KDB_REASON_BREAK: | 1250 | case KDB_REASON_BREAK: |
@@ -1281,6 +1278,9 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, | |||
1281 | */ | 1278 | */ |
1282 | kdb_nextline = 1; | 1279 | kdb_nextline = 1; |
1283 | KDB_STATE_CLEAR(SUPPRESS); | 1280 | KDB_STATE_CLEAR(SUPPRESS); |
1281 | kdb_grepping_flag = 0; | ||
1282 | /* ensure the old search does not leak into '/' commands */ | ||
1283 | kdb_grep_string[0] = '\0'; | ||
1284 | 1284 | ||
1285 | cmdbuf = cmd_cur; | 1285 | cmdbuf = cmd_cur; |
1286 | *cmdbuf = '\0'; | 1286 | *cmdbuf = '\0'; |
@@ -2256,7 +2256,7 @@ static int kdb_cpu(int argc, const char **argv) | |||
2256 | /* | 2256 | /* |
2257 | * Validate cpunum | 2257 | * Validate cpunum |
2258 | */ | 2258 | */ |
2259 | if ((cpunum > NR_CPUS) || !kgdb_info[cpunum].enter_kgdb) | 2259 | if ((cpunum >= CONFIG_NR_CPUS) || !kgdb_info[cpunum].enter_kgdb) |
2260 | return KDB_BADCPUNUM; | 2260 | return KDB_BADCPUNUM; |
2261 | 2261 | ||
2262 | dbg_switch_cpu = cpunum; | 2262 | dbg_switch_cpu = cpunum; |
@@ -2583,7 +2583,7 @@ static int kdb_summary(int argc, const char **argv) | |||
2583 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 2583 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
2584 | kdb_printf("\nMemTotal: %8lu kB\nMemFree: %8lu kB\n" | 2584 | kdb_printf("\nMemTotal: %8lu kB\nMemFree: %8lu kB\n" |
2585 | "Buffers: %8lu kB\n", | 2585 | "Buffers: %8lu kB\n", |
2586 | val.totalram, val.freeram, val.bufferram); | 2586 | K(val.totalram), K(val.freeram), K(val.bufferram)); |
2587 | return 0; | 2587 | return 0; |
2588 | } | 2588 | } |
2589 | 2589 | ||
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h index eaacd1693954..75014d7f4568 100644 --- a/kernel/debug/kdb/kdb_private.h +++ b/kernel/debug/kdb/kdb_private.h | |||
@@ -196,7 +196,9 @@ extern int kdb_main_loop(kdb_reason_t, kdb_reason_t, | |||
196 | 196 | ||
197 | /* Miscellaneous functions and data areas */ | 197 | /* Miscellaneous functions and data areas */ |
198 | extern int kdb_grepping_flag; | 198 | extern int kdb_grepping_flag; |
199 | #define KDB_GREPPING_FLAG_SEARCH 0x8000 | ||
199 | extern char kdb_grep_string[]; | 200 | extern char kdb_grep_string[]; |
201 | #define KDB_GREP_STRLEN 256 | ||
200 | extern int kdb_grep_leading; | 202 | extern int kdb_grep_leading; |
201 | extern int kdb_grep_trailing; | 203 | extern int kdb_grep_trailing; |
202 | extern char *kdb_cmds[]; | 204 | extern char *kdb_cmds[]; |
@@ -209,7 +211,7 @@ extern void kdb_ps1(const struct task_struct *p); | |||
209 | extern void kdb_print_nameval(const char *name, unsigned long val); | 211 | extern void kdb_print_nameval(const char *name, unsigned long val); |
210 | extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); | 212 | extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); |
211 | extern void kdb_meminfo_proc_show(void); | 213 | extern void kdb_meminfo_proc_show(void); |
212 | extern char *kdb_getstr(char *, size_t, char *); | 214 | extern char *kdb_getstr(char *, size_t, const char *); |
213 | extern void kdb_gdb_state_pass(char *buf); | 215 | extern void kdb_gdb_state_pass(char *buf); |
214 | 216 | ||
215 | /* Defines for kdb_symbol_print */ | 217 | /* Defines for kdb_symbol_print */ |
diff --git a/kernel/gcov/Makefile b/kernel/gcov/Makefile index 52aa7e8de927..752d6486b67e 100644 --- a/kernel/gcov/Makefile +++ b/kernel/gcov/Makefile | |||
@@ -1,33 +1,7 @@ | |||
1 | ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"' | 1 | ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"' |
2 | 2 | ||
3 | # if-lt | 3 | obj-y := base.o fs.o |
4 | # Usage VAR := $(call if-lt, $(a), $(b)) | 4 | obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o |
5 | # Returns 1 if (a < b) | 5 | obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o |
6 | if-lt = $(shell [ $(1) -lt $(2) ] && echo 1) | 6 | obj-$(CONFIG_GCOV_FORMAT_AUTODETECT) += $(call cc-ifversion, -lt, 0407, \ |
7 | 7 | gcc_3_4.o, gcc_4_7.o) | |
8 | ifeq ($(CONFIG_GCOV_FORMAT_3_4),y) | ||
9 | cc-ver := 0304 | ||
10 | else ifeq ($(CONFIG_GCOV_FORMAT_4_7),y) | ||
11 | cc-ver := 0407 | ||
12 | else | ||
13 | # Use cc-version if available, otherwise set 0 | ||
14 | # | ||
15 | # scripts/Kbuild.include, which contains cc-version function, is not included | ||
16 | # during make clean "make -f scripts/Makefile.clean obj=kernel/gcov" | ||
17 | # Meaning cc-ver is empty causing if-lt test to fail with | ||
18 | # "/bin/sh: line 0: [: -lt: unary operator expected" error mesage. | ||
19 | # This has no affect on the clean phase, but the error message could be | ||
20 | # confusing/annoying. So this dummy workaround sets cc-ver to zero if cc-version | ||
21 | # is not available. We can probably move if-lt to Kbuild.include, so it's also | ||
22 | # not defined during clean or to include Kbuild.include in | ||
23 | # scripts/Makefile.clean. But the following workaround seems least invasive. | ||
24 | cc-ver := $(if $(call cc-version),$(call cc-version),0) | ||
25 | endif | ||
26 | |||
27 | obj-$(CONFIG_GCOV_KERNEL) := base.o fs.o | ||
28 | |||
29 | ifeq ($(call if-lt, $(cc-ver), 0407),1) | ||
30 | obj-$(CONFIG_GCOV_KERNEL) += gcc_3_4.o | ||
31 | else | ||
32 | obj-$(CONFIG_GCOV_KERNEL) += gcc_4_7.o | ||
33 | endif | ||
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index ff7f47d026ac..782172f073c5 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c | |||
@@ -314,12 +314,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, | |||
314 | rcu_read_lock(); | 314 | rcu_read_lock(); |
315 | func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, | 315 | func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, |
316 | stack_node); | 316 | stack_node); |
317 | rcu_read_unlock(); | ||
318 | |||
319 | if (WARN_ON_ONCE(!func)) | 317 | if (WARN_ON_ONCE(!func)) |
320 | return; | 318 | goto unlock; |
321 | 319 | ||
322 | klp_arch_set_pc(regs, (unsigned long)func->new_func); | 320 | klp_arch_set_pc(regs, (unsigned long)func->new_func); |
321 | unlock: | ||
322 | rcu_read_unlock(); | ||
323 | } | 323 | } |
324 | 324 | ||
325 | static int klp_disable_func(struct klp_func *func) | 325 | static int klp_disable_func(struct klp_func *func) |
@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) | |||
731 | func->state = KLP_DISABLED; | 731 | func->state = KLP_DISABLED; |
732 | 732 | ||
733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, | 733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, |
734 | obj->kobj, func->old_name); | 734 | obj->kobj, "%s", func->old_name); |
735 | } | 735 | } |
736 | 736 | ||
737 | /* parts of the initialization that is done only when the object is loaded */ | 737 | /* parts of the initialization that is done only when the object is loaded */ |
@@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch) | |||
807 | patch->state = KLP_DISABLED; | 807 | patch->state = KLP_DISABLED; |
808 | 808 | ||
809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, | 809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, |
810 | klp_root_kobj, patch->mod->name); | 810 | klp_root_kobj, "%s", patch->mod->name); |
811 | if (ret) | 811 | if (ret) |
812 | goto unlock; | 812 | goto unlock; |
813 | 813 | ||
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 3059bc2f022d..6357265a31ad 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
@@ -1193,7 +1193,9 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, | |||
1193 | ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); | 1193 | ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); |
1194 | 1194 | ||
1195 | if (unlikely(ret)) { | 1195 | if (unlikely(ret)) { |
1196 | remove_waiter(lock, &waiter); | 1196 | __set_current_state(TASK_RUNNING); |
1197 | if (rt_mutex_has_waiters(lock)) | ||
1198 | remove_waiter(lock, &waiter); | ||
1197 | rt_mutex_handle_deadlock(ret, chwalk, &waiter); | 1199 | rt_mutex_handle_deadlock(ret, chwalk, &waiter); |
1198 | } | 1200 | } |
1199 | 1201 | ||
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index c06df7de0963..01cfd69c54c6 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1811,7 +1811,7 @@ int vprintk_default(const char *fmt, va_list args) | |||
1811 | 1811 | ||
1812 | #ifdef CONFIG_KGDB_KDB | 1812 | #ifdef CONFIG_KGDB_KDB |
1813 | if (unlikely(kdb_trap_printk)) { | 1813 | if (unlikely(kdb_trap_printk)) { |
1814 | r = vkdb_printf(fmt, args); | 1814 | r = vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args); |
1815 | return r; | 1815 | return r; |
1816 | } | 1816 | } |
1817 | #endif | 1817 | #endif |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 0d7bbe3095ad..0a571e9a0f1d 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -326,6 +326,7 @@ void rcu_read_unlock_special(struct task_struct *t) | |||
326 | special = t->rcu_read_unlock_special; | 326 | special = t->rcu_read_unlock_special; |
327 | if (special.b.need_qs) { | 327 | if (special.b.need_qs) { |
328 | rcu_preempt_qs(); | 328 | rcu_preempt_qs(); |
329 | t->rcu_read_unlock_special.b.need_qs = false; | ||
329 | if (!t->rcu_read_unlock_special.s) { | 330 | if (!t->rcu_read_unlock_special.s) { |
330 | local_irq_restore(flags); | 331 | local_irq_restore(flags); |
331 | return; | 332 | return; |
diff --git a/kernel/sched/auto_group.c b/kernel/sched/auto_group.c index 8a2e230fb86a..eae160dd669d 100644 --- a/kernel/sched/auto_group.c +++ b/kernel/sched/auto_group.c | |||
@@ -87,8 +87,7 @@ static inline struct autogroup *autogroup_create(void) | |||
87 | * so we don't have to move tasks around upon policy change, | 87 | * so we don't have to move tasks around upon policy change, |
88 | * or flail around trying to allocate bandwidth on the fly. | 88 | * or flail around trying to allocate bandwidth on the fly. |
89 | * A bandwidth exception in __sched_setscheduler() allows | 89 | * A bandwidth exception in __sched_setscheduler() allows |
90 | * the policy change to proceed. Thereafter, task_group() | 90 | * the policy change to proceed. |
91 | * returns &root_task_group, so zero bandwidth is required. | ||
92 | */ | 91 | */ |
93 | free_rt_sched_group(tg); | 92 | free_rt_sched_group(tg); |
94 | tg->rt_se = root_task_group.rt_se; | 93 | tg->rt_se = root_task_group.rt_se; |
@@ -115,9 +114,6 @@ bool task_wants_autogroup(struct task_struct *p, struct task_group *tg) | |||
115 | if (tg != &root_task_group) | 114 | if (tg != &root_task_group) |
116 | return false; | 115 | return false; |
117 | 116 | ||
118 | if (p->sched_class != &fair_sched_class) | ||
119 | return false; | ||
120 | |||
121 | /* | 117 | /* |
122 | * We can only assume the task group can't go away on us if | 118 | * We can only assume the task group can't go away on us if |
123 | * autogroup_move_group() can see us on ->thread_group list. | 119 | * autogroup_move_group() can see us on ->thread_group list. |
diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 7052d3fd4e7b..8d0f35debf35 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c | |||
@@ -274,7 +274,7 @@ bool try_wait_for_completion(struct completion *x) | |||
274 | * first without taking the lock so we can | 274 | * first without taking the lock so we can |
275 | * return early in the blocking case. | 275 | * return early in the blocking case. |
276 | */ | 276 | */ |
277 | if (!ACCESS_ONCE(x->done)) | 277 | if (!READ_ONCE(x->done)) |
278 | return 0; | 278 | return 0; |
279 | 279 | ||
280 | spin_lock_irqsave(&x->wait.lock, flags); | 280 | spin_lock_irqsave(&x->wait.lock, flags); |
@@ -297,6 +297,21 @@ EXPORT_SYMBOL(try_wait_for_completion); | |||
297 | */ | 297 | */ |
298 | bool completion_done(struct completion *x) | 298 | bool completion_done(struct completion *x) |
299 | { | 299 | { |
300 | return !!ACCESS_ONCE(x->done); | 300 | if (!READ_ONCE(x->done)) |
301 | return false; | ||
302 | |||
303 | /* | ||
304 | * If ->done, we need to wait for complete() to release ->wait.lock | ||
305 | * otherwise we can end up freeing the completion before complete() | ||
306 | * is done referencing it. | ||
307 | * | ||
308 | * The RMB pairs with complete()'s RELEASE of ->wait.lock and orders | ||
309 | * the loads of ->done and ->wait.lock such that we cannot observe | ||
310 | * the lock before complete() acquires it while observing the ->done | ||
311 | * after it's acquired the lock. | ||
312 | */ | ||
313 | smp_rmb(); | ||
314 | spin_unlock_wait(&x->wait.lock); | ||
315 | return true; | ||
301 | } | 316 | } |
302 | EXPORT_SYMBOL(completion_done); | 317 | EXPORT_SYMBOL(completion_done); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 13049aac05a6..f0f831e8a345 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -307,66 +307,6 @@ __read_mostly int scheduler_running; | |||
307 | int sysctl_sched_rt_runtime = 950000; | 307 | int sysctl_sched_rt_runtime = 950000; |
308 | 308 | ||
309 | /* | 309 | /* |
310 | * __task_rq_lock - lock the rq @p resides on. | ||
311 | */ | ||
312 | static inline struct rq *__task_rq_lock(struct task_struct *p) | ||
313 | __acquires(rq->lock) | ||
314 | { | ||
315 | struct rq *rq; | ||
316 | |||
317 | lockdep_assert_held(&p->pi_lock); | ||
318 | |||
319 | for (;;) { | ||
320 | rq = task_rq(p); | ||
321 | raw_spin_lock(&rq->lock); | ||
322 | if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) | ||
323 | return rq; | ||
324 | raw_spin_unlock(&rq->lock); | ||
325 | |||
326 | while (unlikely(task_on_rq_migrating(p))) | ||
327 | cpu_relax(); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | /* | ||
332 | * task_rq_lock - lock p->pi_lock and lock the rq @p resides on. | ||
333 | */ | ||
334 | static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags) | ||
335 | __acquires(p->pi_lock) | ||
336 | __acquires(rq->lock) | ||
337 | { | ||
338 | struct rq *rq; | ||
339 | |||
340 | for (;;) { | ||
341 | raw_spin_lock_irqsave(&p->pi_lock, *flags); | ||
342 | rq = task_rq(p); | ||
343 | raw_spin_lock(&rq->lock); | ||
344 | if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) | ||
345 | return rq; | ||
346 | raw_spin_unlock(&rq->lock); | ||
347 | raw_spin_unlock_irqrestore(&p->pi_lock, *flags); | ||
348 | |||
349 | while (unlikely(task_on_rq_migrating(p))) | ||
350 | cpu_relax(); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | static void __task_rq_unlock(struct rq *rq) | ||
355 | __releases(rq->lock) | ||
356 | { | ||
357 | raw_spin_unlock(&rq->lock); | ||
358 | } | ||
359 | |||
360 | static inline void | ||
361 | task_rq_unlock(struct rq *rq, struct task_struct *p, unsigned long *flags) | ||
362 | __releases(rq->lock) | ||
363 | __releases(p->pi_lock) | ||
364 | { | ||
365 | raw_spin_unlock(&rq->lock); | ||
366 | raw_spin_unlock_irqrestore(&p->pi_lock, *flags); | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | * this_rq_lock - lock this runqueue and disable interrupts. | 310 | * this_rq_lock - lock this runqueue and disable interrupts. |
371 | */ | 311 | */ |
372 | static struct rq *this_rq_lock(void) | 312 | static struct rq *this_rq_lock(void) |
@@ -2899,7 +2839,7 @@ void __sched schedule_preempt_disabled(void) | |||
2899 | preempt_disable(); | 2839 | preempt_disable(); |
2900 | } | 2840 | } |
2901 | 2841 | ||
2902 | static void preempt_schedule_common(void) | 2842 | static void __sched notrace preempt_schedule_common(void) |
2903 | { | 2843 | { |
2904 | do { | 2844 | do { |
2905 | __preempt_count_add(PREEMPT_ACTIVE); | 2845 | __preempt_count_add(PREEMPT_ACTIVE); |
@@ -4418,36 +4358,29 @@ EXPORT_SYMBOL_GPL(yield_to); | |||
4418 | * This task is about to go to sleep on IO. Increment rq->nr_iowait so | 4358 | * This task is about to go to sleep on IO. Increment rq->nr_iowait so |
4419 | * that process accounting knows that this is a task in IO wait state. | 4359 | * that process accounting knows that this is a task in IO wait state. |
4420 | */ | 4360 | */ |
4421 | void __sched io_schedule(void) | ||
4422 | { | ||
4423 | struct rq *rq = raw_rq(); | ||
4424 | |||
4425 | delayacct_blkio_start(); | ||
4426 | atomic_inc(&rq->nr_iowait); | ||
4427 | blk_flush_plug(current); | ||
4428 | current->in_iowait = 1; | ||
4429 | schedule(); | ||
4430 | current->in_iowait = 0; | ||
4431 | atomic_dec(&rq->nr_iowait); | ||
4432 | delayacct_blkio_end(); | ||
4433 | } | ||
4434 | EXPORT_SYMBOL(io_schedule); | ||
4435 | |||
4436 | long __sched io_schedule_timeout(long timeout) | 4361 | long __sched io_schedule_timeout(long timeout) |
4437 | { | 4362 | { |
4438 | struct rq *rq = raw_rq(); | 4363 | int old_iowait = current->in_iowait; |
4364 | struct rq *rq; | ||
4439 | long ret; | 4365 | long ret; |
4440 | 4366 | ||
4367 | current->in_iowait = 1; | ||
4368 | if (old_iowait) | ||
4369 | blk_schedule_flush_plug(current); | ||
4370 | else | ||
4371 | blk_flush_plug(current); | ||
4372 | |||
4441 | delayacct_blkio_start(); | 4373 | delayacct_blkio_start(); |
4374 | rq = raw_rq(); | ||
4442 | atomic_inc(&rq->nr_iowait); | 4375 | atomic_inc(&rq->nr_iowait); |
4443 | blk_flush_plug(current); | ||
4444 | current->in_iowait = 1; | ||
4445 | ret = schedule_timeout(timeout); | 4376 | ret = schedule_timeout(timeout); |
4446 | current->in_iowait = 0; | 4377 | current->in_iowait = old_iowait; |
4447 | atomic_dec(&rq->nr_iowait); | 4378 | atomic_dec(&rq->nr_iowait); |
4448 | delayacct_blkio_end(); | 4379 | delayacct_blkio_end(); |
4380 | |||
4449 | return ret; | 4381 | return ret; |
4450 | } | 4382 | } |
4383 | EXPORT_SYMBOL(io_schedule_timeout); | ||
4451 | 4384 | ||
4452 | /** | 4385 | /** |
4453 | * sys_sched_get_priority_max - return maximum RT priority. | 4386 | * sys_sched_get_priority_max - return maximum RT priority. |
@@ -7642,6 +7575,12 @@ static inline int tg_has_rt_tasks(struct task_group *tg) | |||
7642 | { | 7575 | { |
7643 | struct task_struct *g, *p; | 7576 | struct task_struct *g, *p; |
7644 | 7577 | ||
7578 | /* | ||
7579 | * Autogroups do not have RT tasks; see autogroup_create(). | ||
7580 | */ | ||
7581 | if (task_group_is_autogroup(tg)) | ||
7582 | return 0; | ||
7583 | |||
7645 | for_each_process_thread(g, p) { | 7584 | for_each_process_thread(g, p) { |
7646 | if (rt_task(p) && task_group(p) == tg) | 7585 | if (rt_task(p) && task_group(p) == tg) |
7647 | return 1; | 7586 | return 1; |
@@ -7734,6 +7673,17 @@ static int tg_set_rt_bandwidth(struct task_group *tg, | |||
7734 | { | 7673 | { |
7735 | int i, err = 0; | 7674 | int i, err = 0; |
7736 | 7675 | ||
7676 | /* | ||
7677 | * Disallowing the root group RT runtime is BAD, it would disallow the | ||
7678 | * kernel creating (and or operating) RT threads. | ||
7679 | */ | ||
7680 | if (tg == &root_task_group && rt_runtime == 0) | ||
7681 | return -EINVAL; | ||
7682 | |||
7683 | /* No period doesn't make any sense. */ | ||
7684 | if (rt_period == 0) | ||
7685 | return -EINVAL; | ||
7686 | |||
7737 | mutex_lock(&rt_constraints_mutex); | 7687 | mutex_lock(&rt_constraints_mutex); |
7738 | read_lock(&tasklist_lock); | 7688 | read_lock(&tasklist_lock); |
7739 | err = __rt_schedulable(tg, rt_period, rt_runtime); | 7689 | err = __rt_schedulable(tg, rt_period, rt_runtime); |
@@ -7790,9 +7740,6 @@ static int sched_group_set_rt_period(struct task_group *tg, long rt_period_us) | |||
7790 | rt_period = (u64)rt_period_us * NSEC_PER_USEC; | 7740 | rt_period = (u64)rt_period_us * NSEC_PER_USEC; |
7791 | rt_runtime = tg->rt_bandwidth.rt_runtime; | 7741 | rt_runtime = tg->rt_bandwidth.rt_runtime; |
7792 | 7742 | ||
7793 | if (rt_period == 0) | ||
7794 | return -EINVAL; | ||
7795 | |||
7796 | return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); | 7743 | return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); |
7797 | } | 7744 | } |
7798 | 7745 | ||
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index a027799ae130..3fa8fa6d9403 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -511,16 +511,10 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) | |||
511 | struct sched_dl_entity, | 511 | struct sched_dl_entity, |
512 | dl_timer); | 512 | dl_timer); |
513 | struct task_struct *p = dl_task_of(dl_se); | 513 | struct task_struct *p = dl_task_of(dl_se); |
514 | unsigned long flags; | ||
514 | struct rq *rq; | 515 | struct rq *rq; |
515 | again: | ||
516 | rq = task_rq(p); | ||
517 | raw_spin_lock(&rq->lock); | ||
518 | 516 | ||
519 | if (rq != task_rq(p)) { | 517 | rq = task_rq_lock(current, &flags); |
520 | /* Task was moved, retrying. */ | ||
521 | raw_spin_unlock(&rq->lock); | ||
522 | goto again; | ||
523 | } | ||
524 | 518 | ||
525 | /* | 519 | /* |
526 | * We need to take care of several possible races here: | 520 | * We need to take care of several possible races here: |
@@ -541,6 +535,26 @@ again: | |||
541 | 535 | ||
542 | sched_clock_tick(); | 536 | sched_clock_tick(); |
543 | update_rq_clock(rq); | 537 | update_rq_clock(rq); |
538 | |||
539 | /* | ||
540 | * If the throttle happened during sched-out; like: | ||
541 | * | ||
542 | * schedule() | ||
543 | * deactivate_task() | ||
544 | * dequeue_task_dl() | ||
545 | * update_curr_dl() | ||
546 | * start_dl_timer() | ||
547 | * __dequeue_task_dl() | ||
548 | * prev->on_rq = 0; | ||
549 | * | ||
550 | * We can be both throttled and !queued. Replenish the counter | ||
551 | * but do not enqueue -- wait for our wakeup to do that. | ||
552 | */ | ||
553 | if (!task_on_rq_queued(p)) { | ||
554 | replenish_dl_entity(dl_se, dl_se); | ||
555 | goto unlock; | ||
556 | } | ||
557 | |||
544 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); | 558 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); |
545 | if (dl_task(rq->curr)) | 559 | if (dl_task(rq->curr)) |
546 | check_preempt_curr_dl(rq, p, 0); | 560 | check_preempt_curr_dl(rq, p, 0); |
@@ -555,7 +569,7 @@ again: | |||
555 | push_dl_task(rq); | 569 | push_dl_task(rq); |
556 | #endif | 570 | #endif |
557 | unlock: | 571 | unlock: |
558 | raw_spin_unlock(&rq->lock); | 572 | task_rq_unlock(rq, current, &flags); |
559 | 573 | ||
560 | return HRTIMER_NORESTART; | 574 | return HRTIMER_NORESTART; |
561 | } | 575 | } |
@@ -898,6 +912,7 @@ static void yield_task_dl(struct rq *rq) | |||
898 | rq->curr->dl.dl_yielded = 1; | 912 | rq->curr->dl.dl_yielded = 1; |
899 | p->dl.runtime = 0; | 913 | p->dl.runtime = 0; |
900 | } | 914 | } |
915 | update_rq_clock(rq); | ||
901 | update_curr_dl(rq); | 916 | update_curr_dl(rq); |
902 | } | 917 | } |
903 | 918 | ||
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 0870db23d79c..dc0f435a2779 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1380,6 +1380,82 @@ static inline void sched_avg_update(struct rq *rq) { } | |||
1380 | 1380 | ||
1381 | extern void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period); | 1381 | extern void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period); |
1382 | 1382 | ||
1383 | /* | ||
1384 | * __task_rq_lock - lock the rq @p resides on. | ||
1385 | */ | ||
1386 | static inline struct rq *__task_rq_lock(struct task_struct *p) | ||
1387 | __acquires(rq->lock) | ||
1388 | { | ||
1389 | struct rq *rq; | ||
1390 | |||
1391 | lockdep_assert_held(&p->pi_lock); | ||
1392 | |||
1393 | for (;;) { | ||
1394 | rq = task_rq(p); | ||
1395 | raw_spin_lock(&rq->lock); | ||
1396 | if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) | ||
1397 | return rq; | ||
1398 | raw_spin_unlock(&rq->lock); | ||
1399 | |||
1400 | while (unlikely(task_on_rq_migrating(p))) | ||
1401 | cpu_relax(); | ||
1402 | } | ||
1403 | } | ||
1404 | |||
1405 | /* | ||
1406 | * task_rq_lock - lock p->pi_lock and lock the rq @p resides on. | ||
1407 | */ | ||
1408 | static inline struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags) | ||
1409 | __acquires(p->pi_lock) | ||
1410 | __acquires(rq->lock) | ||
1411 | { | ||
1412 | struct rq *rq; | ||
1413 | |||
1414 | for (;;) { | ||
1415 | raw_spin_lock_irqsave(&p->pi_lock, *flags); | ||
1416 | rq = task_rq(p); | ||
1417 | raw_spin_lock(&rq->lock); | ||
1418 | /* | ||
1419 | * move_queued_task() task_rq_lock() | ||
1420 | * | ||
1421 | * ACQUIRE (rq->lock) | ||
1422 | * [S] ->on_rq = MIGRATING [L] rq = task_rq() | ||
1423 | * WMB (__set_task_cpu()) ACQUIRE (rq->lock); | ||
1424 | * [S] ->cpu = new_cpu [L] task_rq() | ||
1425 | * [L] ->on_rq | ||
1426 | * RELEASE (rq->lock) | ||
1427 | * | ||
1428 | * If we observe the old cpu in task_rq_lock, the acquire of | ||
1429 | * the old rq->lock will fully serialize against the stores. | ||
1430 | * | ||
1431 | * If we observe the new cpu in task_rq_lock, the acquire will | ||
1432 | * pair with the WMB to ensure we must then also see migrating. | ||
1433 | */ | ||
1434 | if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) | ||
1435 | return rq; | ||
1436 | raw_spin_unlock(&rq->lock); | ||
1437 | raw_spin_unlock_irqrestore(&p->pi_lock, *flags); | ||
1438 | |||
1439 | while (unlikely(task_on_rq_migrating(p))) | ||
1440 | cpu_relax(); | ||
1441 | } | ||
1442 | } | ||
1443 | |||
1444 | static inline void __task_rq_unlock(struct rq *rq) | ||
1445 | __releases(rq->lock) | ||
1446 | { | ||
1447 | raw_spin_unlock(&rq->lock); | ||
1448 | } | ||
1449 | |||
1450 | static inline void | ||
1451 | task_rq_unlock(struct rq *rq, struct task_struct *p, unsigned long *flags) | ||
1452 | __releases(rq->lock) | ||
1453 | __releases(p->pi_lock) | ||
1454 | { | ||
1455 | raw_spin_unlock(&rq->lock); | ||
1456 | raw_spin_unlock_irqrestore(&p->pi_lock, *flags); | ||
1457 | } | ||
1458 | |||
1383 | #ifdef CONFIG_SMP | 1459 | #ifdef CONFIG_SMP |
1384 | #ifdef CONFIG_PREEMPT | 1460 | #ifdef CONFIG_PREEMPT |
1385 | 1461 | ||
diff --git a/kernel/sys.c b/kernel/sys.c index ea9c88109894..a03d9cd23ed7 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -97,6 +97,12 @@ | |||
97 | #ifndef MPX_DISABLE_MANAGEMENT | 97 | #ifndef MPX_DISABLE_MANAGEMENT |
98 | # define MPX_DISABLE_MANAGEMENT(a) (-EINVAL) | 98 | # define MPX_DISABLE_MANAGEMENT(a) (-EINVAL) |
99 | #endif | 99 | #endif |
100 | #ifndef GET_FP_MODE | ||
101 | # define GET_FP_MODE(a) (-EINVAL) | ||
102 | #endif | ||
103 | #ifndef SET_FP_MODE | ||
104 | # define SET_FP_MODE(a,b) (-EINVAL) | ||
105 | #endif | ||
100 | 106 | ||
101 | /* | 107 | /* |
102 | * this is where the system-wide overflow UID and GID are defined, for | 108 | * this is where the system-wide overflow UID and GID are defined, for |
@@ -1102,6 +1108,7 @@ DECLARE_RWSEM(uts_sem); | |||
1102 | /* | 1108 | /* |
1103 | * Work around broken programs that cannot handle "Linux 3.0". | 1109 | * Work around broken programs that cannot handle "Linux 3.0". |
1104 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 | 1110 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 |
1111 | * And we map 4.x to 2.6.60+x, so 4.0 would be 2.6.60. | ||
1105 | */ | 1112 | */ |
1106 | static int override_release(char __user *release, size_t len) | 1113 | static int override_release(char __user *release, size_t len) |
1107 | { | 1114 | { |
@@ -1121,7 +1128,7 @@ static int override_release(char __user *release, size_t len) | |||
1121 | break; | 1128 | break; |
1122 | rest++; | 1129 | rest++; |
1123 | } | 1130 | } |
1124 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; | 1131 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 60; |
1125 | copy = clamp_t(size_t, len, 1, sizeof(buf)); | 1132 | copy = clamp_t(size_t, len, 1, sizeof(buf)); |
1126 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); | 1133 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); |
1127 | ret = copy_to_user(release, buf, copy + 1); | 1134 | ret = copy_to_user(release, buf, copy + 1); |
@@ -2219,6 +2226,12 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
2219 | return -EINVAL; | 2226 | return -EINVAL; |
2220 | error = MPX_DISABLE_MANAGEMENT(me); | 2227 | error = MPX_DISABLE_MANAGEMENT(me); |
2221 | break; | 2228 | break; |
2229 | case PR_SET_FP_MODE: | ||
2230 | error = SET_FP_MODE(me, arg2); | ||
2231 | break; | ||
2232 | case PR_GET_FP_MODE: | ||
2233 | error = GET_FP_MODE(me); | ||
2234 | break; | ||
2222 | default: | 2235 | default: |
2223 | error = -EINVAL; | 2236 | error = -EINVAL; |
2224 | break; | 2237 | break; |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 4b585e0fdd22..0f60b08a4f07 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -633,10 +633,14 @@ int ntp_validate_timex(struct timex *txc) | |||
633 | if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) | 633 | if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) |
634 | return -EPERM; | 634 | return -EPERM; |
635 | 635 | ||
636 | if (txc->modes & ADJ_FREQUENCY) { | 636 | /* |
637 | if (LONG_MIN / PPM_SCALE > txc->freq) | 637 | * Check for potential multiplication overflows that can |
638 | * only happen on 64-bit systems: | ||
639 | */ | ||
640 | if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { | ||
641 | if (LLONG_MIN / PPM_SCALE > txc->freq) | ||
638 | return -EINVAL; | 642 | return -EINVAL; |
639 | if (LONG_MAX / PPM_SCALE < txc->freq) | 643 | if (LLONG_MAX / PPM_SCALE < txc->freq) |
640 | return -EINVAL; | 644 | return -EINVAL; |
641 | } | 645 | } |
642 | 646 | ||