]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-small_fixes.patch
- fix for adjtimex failed for set_frequency... error
[packages/kernel.git] / kernel-small_fixes.patch
CommitLineData
08aa9d92 1--- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
2+++ linux-2.6.33/scripts/mod/modpost.c 2010-03-07 14:26:47.242168558 +0100
3@@ -15,7 +15,8 @@
4 #include <stdio.h>
5 #include <ctype.h>
6 #include "modpost.h"
7-#include "../../include/generated/autoconf.h"
8+// PLD architectures don't use CONFIG_SYMBOL_PREFIX
9+//#include "../../include/generated/autoconf.h"
10 #include "../../include/linux/license.h"
11
12 /* Some toolchains use a `_' prefix for all user symbols. */
13
2136e199
AM
14--- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~ 2011-07-22 04:17:23.000000000 +0200
15+++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh 2011-08-25 21:26:04.799150642 +0200
16@@ -9,6 +9,12 @@
17 $cc -print-file-name=lib${lib}.${ext} | grep -q /
18 if [ $? -eq 0 ]; then
19 echo "-l${lib}"
20+ for libt in tinfow tinfo ; do
21+ $cc -print-file-name=lib${libt}.${ext} | grep -q /
22+ if [ $? -eq 0 ]; then
23+ echo "-l${libt}"
24+ fi
25+ done
26 exit
27 fi
28 done
483f80a3
JR
29From 29183a70b0b828500816bd794b3fe192fce89f73 Mon Sep 17 00:00:00 2001
30From: John Stultz <john.stultz@linaro.org>
31Date: Mon, 9 Feb 2015 23:30:36 -0800
32Subject: ntp: Fixup adjtimex freq validation on 32-bit systems
33
34Additional validation of adjtimex freq values to avoid
35potential multiplication overflows were added in commit
365e5aeb4367b (time: adjtimex: Validate the ADJ_FREQUENCY values)
37
38Unfortunately the patch used LONG_MAX/MIN instead of
39LLONG_MAX/MIN, which was fine on 64-bit systems, but being
40much smaller on 32-bit systems caused false positives
41resulting in most direct frequency adjustments to fail w/
42EINVAL.
43
44ntpd only does direct frequency adjustments at startup, so
45the issue was not as easily observed there, but other time
46sync applications like ptpd and chrony were more effected by
47the bug.
48
49See bugs:
50
51 https://bugzilla.kernel.org/show_bug.cgi?id=92481
52 https://bugzilla.redhat.com/show_bug.cgi?id=1188074
53
54This patch changes the checks to use LLONG_MAX for
55clarity, and additionally the checks are disabled
56on 32-bit systems since LLONG_MAX/PPM_SCALE is always
57larger then the 32-bit long freq value, so multiplication
58overflows aren't possible there.
59
60Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
61Reported-by: George Joseph <george.joseph@fairview5.com>
62Tested-by: George Joseph <george.joseph@fairview5.com>
63Signed-off-by: John Stultz <john.stultz@linaro.org>
64Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
65Cc: <stable@vger.kernel.org> # v3.19+
66Cc: Linus Torvalds <torvalds@linux-foundation.org>
67Cc: Sasha Levin <sasha.levin@oracle.com>
68Link: http://lkml.kernel.org/r/1423553436-29747-1-git-send-email-john.stultz@linaro.org
69[ Prettified the changelog and the comments a bit. ]
70Signed-off-by: Ingo Molnar <mingo@kernel.org>
71
72diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
73index 4b585e0..0f60b08 100644
74--- a/kernel/time/ntp.c
75+++ b/kernel/time/ntp.c
76@@ -633,10 +633,14 @@ int ntp_validate_timex(struct timex *txc)
77 if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
78 return -EPERM;
79
80- if (txc->modes & ADJ_FREQUENCY) {
81- if (LONG_MIN / PPM_SCALE > txc->freq)
82+ /*
83+ * Check for potential multiplication overflows that can
84+ * only happen on 64-bit systems:
85+ */
86+ if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) {
87+ if (LLONG_MIN / PPM_SCALE > txc->freq)
88 return -EINVAL;
89- if (LONG_MAX / PPM_SCALE < txc->freq)
90+ if (LLONG_MAX / PPM_SCALE < txc->freq)
91 return -EINVAL;
92 }
93
94--
95cgit v0.10.2
96
This page took 0.19814 seconds and 4 git commands to generate.