]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
- fix for adjtimex failed for set_frequency... error
[packages/kernel.git] / kernel-small_fixes.patch
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
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
29 From 29183a70b0b828500816bd794b3fe192fce89f73 Mon Sep 17 00:00:00 2001
30 From: John Stultz <john.stultz@linaro.org>
31 Date: Mon, 9 Feb 2015 23:30:36 -0800
32 Subject: ntp: Fixup adjtimex freq validation on 32-bit systems
33
34 Additional validation of adjtimex freq values to avoid
35 potential multiplication overflows were added in commit
36 5e5aeb4367b (time: adjtimex: Validate the ADJ_FREQUENCY values)
37
38 Unfortunately the patch used LONG_MAX/MIN instead of
39 LLONG_MAX/MIN, which was fine on 64-bit systems, but being
40 much smaller on 32-bit systems caused false positives
41 resulting in most direct frequency adjustments to fail w/
42 EINVAL.
43
44 ntpd only does direct frequency adjustments at startup, so
45 the issue was not as easily observed there, but other time
46 sync applications like ptpd and chrony were more effected by
47 the bug.
48
49 See bugs:
50
51   https://bugzilla.kernel.org/show_bug.cgi?id=92481
52   https://bugzilla.redhat.com/show_bug.cgi?id=1188074
53
54 This patch changes the checks to use LLONG_MAX for
55 clarity, and additionally the checks are disabled
56 on 32-bit systems since LLONG_MAX/PPM_SCALE is always
57 larger then the 32-bit long freq value, so multiplication
58 overflows aren't possible there.
59
60 Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
61 Reported-by: George Joseph <george.joseph@fairview5.com>
62 Tested-by: George Joseph <george.joseph@fairview5.com>
63 Signed-off-by: John Stultz <john.stultz@linaro.org>
64 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
65 Cc: <stable@vger.kernel.org> # v3.19+
66 Cc: Linus Torvalds <torvalds@linux-foundation.org>
67 Cc: Sasha Levin <sasha.levin@oracle.com>
68 Link: http://lkml.kernel.org/r/1423553436-29747-1-git-send-email-john.stultz@linaro.org
69 [ Prettified the changelog and the comments a bit. ]
70 Signed-off-by: Ingo Molnar <mingo@kernel.org>
71
72 diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
73 index 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 -- 
95 cgit v0.10.2
96
This page took 0.071111 seconds and 4 git commands to generate.