diff mbox

[linux-stable] 4fc2942b6e kernel BUG at kernel/time/hrtimer.c:109!

Message ID alpine.DEB.2.20.1702171014430.3536@nanos (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show

Commit Message

Thomas Gleixner Feb. 17, 2017, 9:28 a.m. UTC
On Fri, 17 Feb 2017, kernel test robot wrote:

> Hi Marc,
> 
> We find this oops in linux-4.4.y. The gcc-6 compiled mainline kernel is fine.
> 
> commit 4fc2942b6e2de2efc8a9d3784d4b0d3543149613
>      hrtimer: Catch illegal clockids

And that commit is doing what the subject line says. Catch illegal usage.

> [   38.101342] Call Trace:
> [   38.101342] Call Trace:
> [   38.102045]  [<ffffffff8109aee1>] tasklet_hrtimer_init+0x16/0x52
> [   38.102045]  [<ffffffff8109aee1>] tasklet_hrtimer_init+0x16/0x52
> [   38.103698]  [<ffffffff81c767c7>] mac80211_hwsim_new_radio+0x766/0x84d

The real bug is in this code:

drivers/net/wireless/mac80211_hwsim.c

mac80211_hwsim_new_radio()

        tasklet_hrtimer_init(&data->beacon_timer,
                             mac80211_hwsim_beacon,
                             CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);

CLOCK_MONOTONIC_RAW is not a supported clockid for hrtimers. Sigh.

Fix below.

Thanks,

	tglx

8<------------------

Comments

Marc Zyngier Feb. 17, 2017, 10:09 a.m. UTC | #1
On 17/02/17 09:28, Thomas Gleixner wrote:
> On Fri, 17 Feb 2017, kernel test robot wrote:
> 
>> Hi Marc,
>>
>> We find this oops in linux-4.4.y. The gcc-6 compiled mainline kernel is fine.

The last bit is worrying, as mainline has the exact same bug. Has it
been tested the same way?

>>
>> commit 4fc2942b6e2de2efc8a9d3784d4b0d3543149613
>>      hrtimer: Catch illegal clockids
> 
> And that commit is doing what the subject line says. Catch illegal usage.
> 
>> [   38.101342] Call Trace:
>> [   38.101342] Call Trace:
>> [   38.102045]  [<ffffffff8109aee1>] tasklet_hrtimer_init+0x16/0x52
>> [   38.102045]  [<ffffffff8109aee1>] tasklet_hrtimer_init+0x16/0x52
>> [   38.103698]  [<ffffffff81c767c7>] mac80211_hwsim_new_radio+0x766/0x84d
> 
> The real bug is in this code:
> 
> drivers/net/wireless/mac80211_hwsim.c
> 
> mac80211_hwsim_new_radio()
> 
>         tasklet_hrtimer_init(&data->beacon_timer,
>                              mac80211_hwsim_beacon,
>                              CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
> 
> CLOCK_MONOTONIC_RAW is not a supported clockid for hrtimers. Sigh.
> 
> Fix below.
> 
> Thanks,
> 
> 	tglx
> 
> 8<------------------
> 
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index 0cd95120bc78..da363ec91a1c 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -2535,9 +2535,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
>  				    data->debugfs,
>  				    data, &hwsim_simulate_radar);
>  
> -	tasklet_hrtimer_init(&data->beacon_timer,
> -			     mac80211_hwsim_beacon,
> -			     CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
> +	tasklet_hrtimer_init(&data->beacon_timer, mac80211_hwsim_beacon,
> +			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
>  
>  	spin_lock_bh(&hwsim_radio_lock);
>  	list_add_tail(&data->list, &hwsim_radios);
> 

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
Thomas Gleixner Feb. 17, 2017, 10:16 a.m. UTC | #2
On Fri, 17 Feb 2017, Marc Zyngier wrote:

> On 17/02/17 09:28, Thomas Gleixner wrote:
> > On Fri, 17 Feb 2017, kernel test robot wrote:
> > 
> >> Hi Marc,
> >>
> >> We find this oops in linux-4.4.y. The gcc-6 compiled mainline kernel is fine.
> 
> The last bit is worrying, as mainline has the exact same bug. Has it
> been tested the same way?

The thing is that we reverted that patch in mainline:

See: commit 82e88ff1ea948d83125a8aaa7c9809f03ccc500f

I don't know why I reverted that as well. I should have kept it. Darn. I
cherry pick it and send it linus wards next week.

Thanks,

	tglx
Marc Zyngier Feb. 17, 2017, 10:31 a.m. UTC | #3
On 17/02/17 10:16, Thomas Gleixner wrote:
> On Fri, 17 Feb 2017, Marc Zyngier wrote:
> 
>> On 17/02/17 09:28, Thomas Gleixner wrote:
>>> On Fri, 17 Feb 2017, kernel test robot wrote:
>>>
>>>> Hi Marc,
>>>>
>>>> We find this oops in linux-4.4.y. The gcc-6 compiled mainline kernel is fine.
>>
>> The last bit is worrying, as mainline has the exact same bug. Has it
>> been tested the same way?
> 
> The thing is that we reverted that patch in mainline:
> 
> See: commit 82e88ff1ea948d83125a8aaa7c9809f03ccc500f

Ah, right. It got nuked as part of the whole MONOTONIC_RAW blunder.

> I don't know why I reverted that as well. I should have kept it. Darn. I
> cherry pick it and send it linus wards next week.

Yes, I still think this single patch is a valuable sanity check.

Thanks,

	M.
Fengguang Wu Feb. 17, 2017, 12:49 p.m. UTC | #4
On Fri, Feb 17, 2017 at 10:09:06AM +0000, Marc Zyngier wrote:
>On 17/02/17 09:28, Thomas Gleixner wrote:
>> On Fri, 17 Feb 2017, kernel test robot wrote:
>>
>>> Hi Marc,
>>>
>>> We find this oops in linux-4.4.y. The gcc-6 compiled mainline kernel is fine.
>
>The last bit is worrying, as mainline has the exact same bug. Has it
>been tested the same way?

Nope, mainline is not tested the same way because gcc-4.6 cannot build
a mainline kernel due to gcc-plugin related build errors.

Thanks,
Fengguang
diff mbox

Patch

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 0cd95120bc78..da363ec91a1c 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2535,9 +2535,8 @@  static int mac80211_hwsim_new_radio(struct genl_info *info,
 				    data->debugfs,
 				    data, &hwsim_simulate_radar);
 
-	tasklet_hrtimer_init(&data->beacon_timer,
-			     mac80211_hwsim_beacon,
-			     CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
+	tasklet_hrtimer_init(&data->beacon_timer, mac80211_hwsim_beacon,
+			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 	spin_lock_bh(&hwsim_radio_lock);
 	list_add_tail(&data->list, &hwsim_radios);