From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EEB7C2B9F4 for ; Tue, 22 Jun 2021 08:06:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B8AD61380 for ; Tue, 22 Jun 2021 08:06:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbhFVIJA (ORCPT ); Tue, 22 Jun 2021 04:09:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:42280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbhFVII7 (ORCPT ); Tue, 22 Jun 2021 04:08:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D2A861351; Tue, 22 Jun 2021 08:06:40 +0000 (UTC) Date: Tue, 22 Jun 2021 10:06:39 +0200 From: Christian Brauner To: Thomas Gleixner Cc: syzbot , axboe@kernel.dk, christian@brauner.io, ebiederm@xmission.com, elver@google.com, linux-kernel@vger.kernel.org, oleg@redhat.com, pcc@google.com, peterz@infradead.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] signal: Prevent sigqueue caching after task got released Message-ID: <20210622080639.nk5buzset4ucchnk@wittgenstein> References: <000000000000148b4b05c419cbbb@google.com> <878s32g6j5.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <878s32g6j5.ffs@nanos.tec.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 01:08:30AM +0200, Thomas Gleixner wrote: > syzbot reported a memory leak related to sigqueue caching. This happens > when a thread group leader with child tasks is reaped. > > The group leader's sigqueue_cache is correctly freed. The group leader then > reaps the child tasks and if any of them has a signal pending it caches > that signal. That's obviously bogus because nothing will free the cached > signal of the reaped group leader anymore. > > Prevent this by setting tsk::sigqueue_cache to an error pointer value in > exit_task_sigqueue_cache(). > > Add comments to all relevant places. > > Fixes: 4bad58ebc8bc ("signal: Allow tasks to cache one sigqueue struct") > Reported-by: syzbot+0bac5fec63d4f399ba98@syzkaller.appspotmail.com > Signed-off-by: Thomas Gleixner > --- Acked-by: Christian Brauner