[Devel] [PATCH RH7] ub: ub_ratelimit does not initialize ub_ratelimit->lock
Vasily Averin
vvs at virtuozzo.com
Tue Jun 15 16:00:03 MSK 2021
repro02 from PSBM-130602 executed on debug kernel inside centos7
container triggers the following message:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
Call Trace:
[<ffffffff96ec9edc>] dump_stack+0x19/0x1b
[<ffffffff96ec21fa>] register_lock_class.part.27+0x38/0x3c
[<ffffffff96760426>] __lock_acquire+0x1276/0x1630
[<ffffffff967610c9>] lock_acquire+0x99/0x1e0
[<ffffffff96ed50d4>] _raw_spin_trylock+0x64/0x80
[<ffffffff96a5bb11>] ___ratelimit+0x51/0x140
[<ffffffff9674a707>] __charge_beancounter_locked+0x147/0x170
[<ffffffff9674a77f>] charge_beancounter+0x4f/0x80
[<ffffffff96da822e>] xt_replace_table+0x1de/0x3d0
...
Fatal resource shortage: numiptent, UB xxxx
This happen because of ub.ub_ratelimit does not have properly
initialized 'lock' spinlock.
https://jira.sw.ru/browse/PSBM-130672
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
kernel/bc/beancounter.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 287d4c5440a4..5e04d6c0c9b1 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -1067,8 +1067,7 @@ static void init_beancounter_nolimits(struct user_beancounter *ub)
ub->ub_parms[UB_OOMGUARPAGES].barrier = totalram_pages * 3 / 4;
/* Ratelimit for messages in the kernel log */
- ub->ub_ratelimit.burst = 4;
- ub->ub_ratelimit.interval = 300*HZ;
+ ratelimit_state_init(&ub->ub_ratelimit, 300*HZ, 4);
}
static DEFINE_PER_CPU(struct ub_percpu_struct, ub0_percpu);
--
2.25.1
More information about the Devel
mailing list