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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D6EDC433EF for ; Wed, 8 Dec 2021 06:53:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F17056B0071; Wed, 8 Dec 2021 01:53:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EC66A6B0073; Wed, 8 Dec 2021 01:53:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D66636B0074; Wed, 8 Dec 2021 01:53:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay027.a.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id C8AC26B0071 for ; Wed, 8 Dec 2021 01:53:37 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id D1B44801B3 for ; Wed, 8 Dec 2021 04:33:18 +0000 (UTC) X-FDA: 78893357676.14.E5AECF4 Received: from relay.hostedemail.com (unknown [216.40.35.100]) by imf22.hostedemail.com (Postfix) with ESMTP id 61AD01902 for ; Wed, 8 Dec 2021 04:33:18 +0000 (UTC) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 85053212F6 for ; Wed, 8 Dec 2021 04:13:32 +0000 (UTC) X-FDA: 78893307822.13.58A5A7C Received: from relay.hostedemail.com (relay035.a.hostedemail.com [64.99.140.35]) by imf13.hostedemail.com (Postfix) with ESMTP id E2FE91044ABA for ; Wed, 8 Dec 2021 04:13:31 +0000 (UTC) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D2AE3929 for ; Wed, 8 Dec 2021 03:38:19 +0000 (UTC) X-FDA: 78893219160.22.DCA5DE9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 46F5F7000091 for ; Wed, 8 Dec 2021 03:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638934698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Usm8/O3x4Vrv4f3qn7WGdypmLDEtXX7cryGdxfW72lM=; b=RsxOuAkPWRG7MlYZGh6Dy3KF3PipceuLRcgNvaSS2TdL8EBm5+BlXDUUmtfH9lGy/YJ99r 2UZlr4uZWUNWcnTIjGY28bCXOTnxikpmiWhn+d62eHe5fuYqHoiRhmAO6GZzD7d4oFQBTq IznmYU81K0Pu5OlOzKgzRkiOau3uc2k= Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-qdiekl3vMgmHnLDE5vlJOA-1; Tue, 07 Dec 2021 22:38:16 -0500 X-MC-Unique: qdiekl3vMgmHnLDE5vlJOA-1 Received: by mail-yb1-f199.google.com with SMTP id s189-20020a252cc6000000b005c1f206d91eso2255603ybs.14 for ; Tue, 07 Dec 2021 19:38:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Usm8/O3x4Vrv4f3qn7WGdypmLDEtXX7cryGdxfW72lM=; b=evZox9Vv6suPzQU4hqZSPkRi/dzkgJqUi0GN3Y9kGCNKXqsXBamHdfYvOxK0L1Umhd uRmnXtdaVH0ZxrK63FSEh429yRjd/XnSRbYAa6y+NRa1eie7nldraTbHzUaO8yKRB0Wi jWKAl+d2svjK61OhYcycKVWqiVYzRORo0MEwRHqH/C3L656hK6FpSbWjv5ySwYkMDgtO s1wt/vU7Y1sqKyNTKbA246QAZMDHdGbQHQvER07yt+gU5kUY8DRyDyXlgO4oQ8mdzA39 /ypRiBjFQBYCK5/5TY3pEJm3RmEIZ+Y+7FPr1g0pcWcMLFyVWI5Dqd/EUjT2XFN1OgpO W8zg== X-Gm-Message-State: AOAM531fToVitV0j2hxJ9I8hhsh3L+TuQrsqSHBUaYDk/R6oQZ6W5UjD mxCqJq7Gy/W5N9N6uN/ZPaKB1Fn7NCSM12VHNu2l2PmsgSwnKRC25QYkKKp+Ou/4Lnikh8bds8t /2ArEBJBhblP7DMu8yweo34hpEnQ= X-Received: by 2002:a25:d792:: with SMTP id o140mr18123290ybg.493.1638934696508; Tue, 07 Dec 2021 19:38:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrSZ/145BJDSM88ngNZDMqi4jaqquB9mohl2mSpkU5+Q8Ltv+dUGjNwpGCZVVN6/6gXiwWN9d3XodP8QLOTOU= X-Received: by 2002:a25:d792:: with SMTP id o140mr18123274ybg.493.1638934696324; Tue, 07 Dec 2021 19:38:16 -0800 (PST) MIME-Version: 1.0 References: <20211207214902.772614-1-jsavitz@redhat.com> <20211207154759.3f3fe272349c77e0c4aca36f@linux-foundation.org> <20211207175816.8c45ff5b82cb964ade82d6f1@linux-foundation.org> In-Reply-To: <20211207175816.8c45ff5b82cb964ade82d6f1@linux-foundation.org> From: Joel Savitz Date: Tue, 7 Dec 2021 22:38:00 -0500 Message-ID: Subject: Re: [PATCH] mm/oom_kill: wake futex waiters before annihilating victim shared mutex To: Andrew Morton Cc: Nico Pache , linux-kernel , Waiman Long , linux-mm@kvack.org, Peter Zijlstra , Michal Hocko X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-HE-Tag-Orig: 1638934699-910824 X-Stat-Signature: 8abu5t3c44bggshroqq4uhbadskq3hmh X-HE-Tag-Orig: 1638936811-924810 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RsxOuAkP; spf=none (imf22.hostedemail.com: domain of FILTER%FILTER%jsavitz@redhat.com has no SPF policy when checking 216.40.35.100) smtp.mailfrom=FILTER%FILTER%jsavitz@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 61AD01902 X-HE-Tag: 1638937998-222446 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 7, 2021 at 8:58 PM Andrew Morton wrote: > > On Tue, 7 Dec 2021 19:46:57 -0500 Nico Pache wrote: > > > > > > > On 12/7/21 18:47, Andrew Morton wrote: > > > (cc's added) > > > > > > On Tue, 7 Dec 2021 16:49:02 -0500 Joel Savitz wrote: > > > > > >> In the case that two or more processes share a futex located within > > >> a shared mmaped region, such as a process that shares a lock between > > >> itself and a number of child processes, we have observed that when > > >> a process holding the lock is oom killed, at least one waiter is never > > >> alerted to this new development and simply continues to wait. > > > > > > Well dang. Is there any way of killing off that waiting process, or do > > > we have a resource leak here? > > > > If I understood your question correctly, there is a way to recover the system by > > killing the process that is utilizing the futex; however, the purpose of robust > > futexes is to avoid having to do this. > > OK. My concern was whether we have a way in which userspace can > permanently leak memory, which opens a (lame) form of denial-of-service > attack. I believe the resources are freed when the process is killed so to my knowledge there is no resource leak in the case we were investigating. > > >From my work with Joel on this it seems like a race is occurring between the > > oom_reaper and the exit signal sent to the OMM'd process. By setting the > > futex_exit_release before these signals are sent we avoid this. > > OK. It would be nice if the patch had some comments explaining *why* > we're doing this strange futex thing here. Although that wouldn't be > necessary if futex_exit_release() was documented... > Sounds good, will send a v2 tomorrow Best, Joel Savitz