From: Thomas Gleixner <tglx@linutronix.de>
To: kernel test robot <oliver.sang@intel.com>,
Artem Savkov <asavkov@redhat.com>
Cc: 0day robot <lkp@intel.com>, Josh Poimboeuf <jpoimboe@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
lkp@lists.01.org, netdev@vger.kernel.org, davem@davemloft.net,
yoshfuji@linux-ipv6.org, dsahern@kernel.org,
Artem Savkov <asavkov@redhat.com>
Subject: Re: [timer] d41e0719d5: UBSAN:shift-out-of-bounds_in_lib/flex_proportions.c
Date: Fri, 25 Mar 2022 20:14:27 +0100 [thread overview]
Message-ID: <87k0chhmjw.ffs@tglx> (raw)
In-Reply-To: <20220325073827.GB8478@xsang-OptiPlex-9020>
On Fri, Mar 25 2022 at 15:38, kernel test robot wrote:
> [ 42.401895][ C0] UBSAN: shift-out-of-bounds in lib/flex_proportions.c:80:20
> [ 42.410963][ C0] shift exponent -1007885658 is negative
Cute.
> [ 42.416462][ C0] CPU: 0 PID: 330 Comm: sed Tainted: G I 5.17.0-rc6-00027-gd41e0719d576 #1
> [ 42.426240][ C0] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 1.1.1 10/07/2015
> [ 42.434363][ C0] Call Trace:
> [ 42.437516][ C0] <TASK>
> [ 42.440319][ C0] dump_stack_lvl (lib/dump_stack.c:107)
> [ 42.444699][ C0] ubsan_epilogue (lib/ubsan.c:152)
> [ 42.448985][ C0] __ubsan_handle_shift_out_of_bounds.cold (lib/ubsan.c:330)
> [ 42.455618][ C0] ? cpumask_next (lib/cpumask.c:23)
> [ 42.459996][ C0] ? __percpu_counter_sum (lib/percpu_counter.c:138)
> [ 42.465248][ C0] fprop_new_period.cold (lib/flex_proportions.c:80 (discriminator 1))
> [ 42.470224][ C0] writeout_period (mm/page-writeback.c:623)
So it seems a timer fired early. Which then makes writeout_period() go south:
int miss_periods = (jiffies - dom->period_time) / VM_COMPLETIONS_PERIOD_LEN;
If jiffies < dom->period_time the result is a very large negative
number.
This happens because of:
> @@ -67,7 +67,8 @@ struct timer_list {
> #define TIMER_DEFERRABLE 0x00080000
> #define TIMER_PINNED 0x00100000
> #define TIMER_IRQSAFE 0x00200000
> -#define TIMER_INIT_FLAGS (TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
> +#define TIMER_UPPER_BOUND 0x00400000
> +#define TIMER_INIT_FLAGS (TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE | TIMER_UPPER_BOUND)
> #define TIMER_ARRAYSHIFT 22
> #define TIMER_ARRAYMASK 0xFFC00000
TIMER_UPPER_BOUND steals a bit from the ARRAYMASK. So if the timer is
armed and the stored arraymask happens to have bit 22 set, then on the
next arming of the timer it will be treated as upper bound timer,
expires early and all hell breaks lose. The same can happen the other
way round. So I really have to ask how this ever "worked".
Thanks,
tglx
next prev parent reply other threads:[~2022-03-25 19:42 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 11:16 [PATCH 0/2] Upper bound mode for kernel timers Artem Savkov
2022-03-23 11:16 ` [PATCH 1/2] timer: introduce upper bound timers Artem Savkov
2022-03-23 18:40 ` Josh Poimboeuf
2022-03-24 9:14 ` [PATCH v2 0/2] Upper bound mode for kernel timers Artem Savkov
2022-03-24 9:14 ` [PATCH v2 1/2] timer: introduce upper bound timers Artem Savkov
2022-03-24 9:15 ` [PATCH v2 2/2] net: make tcp keepalive timer upper bound Artem Savkov
2022-03-24 12:28 ` [PATCH 1/2] timer: introduce upper bound timers Thomas Gleixner
2022-03-24 13:54 ` Thomas Gleixner
2022-03-26 21:13 ` Thomas Gleixner
2022-03-30 8:20 ` [PATCH v3 0/2] Upper bound kernel timers Artem Savkov
2022-03-30 8:20 ` [PATCH v3 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-03-30 13:40 ` Anna-Maria Behnsen
2022-04-02 6:55 ` Artem Savkov
2022-04-05 15:33 ` Thomas Gleixner
2022-04-07 7:52 ` [PATCH v4 0/2] Upper bound kernel timers Artem Savkov
2022-04-07 7:52 ` [PATCH v4 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-04-08 0:37 ` Thomas Gleixner
2022-04-08 5:39 ` Josh Poimboeuf
2022-04-12 13:42 ` Artem Savkov
2022-05-05 13:18 ` [PATCH v5 0/2] Upper bound kernel timers Artem Savkov
2022-05-05 13:18 ` [PATCH v5 1/2] timer: add a function to adjust timeouts to be upper bound Artem Savkov
2022-05-05 13:18 ` [PATCH v5 2/2] net: make tcp keepalive timer " Artem Savkov
2022-05-05 17:56 ` Josh Poimboeuf
2022-05-06 6:39 ` Artem Savkov
2022-05-06 16:24 ` Josh Poimboeuf
2022-07-26 22:42 ` [PATCH v5 0/2] Upper bound kernel timers Josh Poimboeuf
2022-04-07 7:52 ` [PATCH v4 2/2] net: make tcp keepalive timer upper bound Artem Savkov
[not found] ` <Yk1i3WrcVIICAiF0@samus.usersys.redhat.com>
2022-04-07 23:26 ` [PATCH v3 1/2] timer: add a function to adjust timeouts to be " Thomas Gleixner
2022-03-30 8:20 ` [PATCH v3 2/2] net: make tcp keepalive timer " Artem Savkov
2022-04-02 3:09 ` [net] 6ef3f95797: UBSAN:shift-out-of-bounds_in_kernel/time/timer.c kernel test robot
2022-04-02 7:11 ` Artem Savkov
2022-03-30 10:28 ` [PATCH v3 0/2] Upper bound kernel timers David Laight
2022-03-25 7:38 ` [timer] d41e0719d5: UBSAN:shift-out-of-bounds_in_lib/flex_proportions.c kernel test robot
2022-03-25 19:14 ` Thomas Gleixner [this message]
2022-03-23 11:16 ` [PATCH 2/2] net: make tcp keepalive timer upper bound Artem Savkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0chhmjw.ffs@tglx \
--to=tglx@linutronix.de \
--cc=asavkov@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lkp@lists.01.org \
--cc=netdev@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).