lkml.org 
[lkml]   [2022]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [syzbot] BUG: unable to handle kernel paging request in percpu_counter_add_batch
On Thu, Oct 20, 2022 at 07:44:27PM -0700, Andrew Morton wrote:
> On Thu, 20 Oct 2022 19:24:40 -0700 syzbot <syzbot+96e659d35b9d6b541152@syzkaller.appspotmail.com> wrote:

> Well. freeque() messes with ns->percpu_msg_hdrs but msg_exit_ns()
> already did percpu_counter_destroy(&ns->percpu_msg_hdrs);
>
> I'm thinking something like this?
>
> --- a/ipc/msg.c~a
> +++ a/ipc/msg.c
> @@ -1329,11 +1329,11 @@ fail_msg_bytes:
> #ifdef CONFIG_IPC_NS
> void msg_exit_ns(struct ipc_namespace *ns)
> {
> - percpu_counter_destroy(&ns->percpu_msg_bytes);
> - percpu_counter_destroy(&ns->percpu_msg_hdrs);
> free_ipcs(ns, &msg_ids(ns), freeque);
> idr_destroy(&ns->ids[IPC_MSG_IDS].ipcs_idr);
> rhashtable_destroy(&ns->ids[IPC_MSG_IDS].key_ht);
> + percpu_counter_destroy(&ns->percpu_msg_bytes);
> + percpu_counter_destroy(&ns->percpu_msg_hdrs);
> }
> #endif

That seems to fix the issue for me, testing with the reproducer in my prior
reply. Previously that would trigger within seconds, and with the above applied
I couldn't get it to trigger after 15+ minutes of repeated test runs.

FWIW:

Tested-by: Mark Rutland <mark.rutland@arm.com>

Thanks,
Mark.

\
 
 \ /
  Last update: 2022-10-21 11:58    [W:0.042 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site