Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2250893imm; Thu, 23 Aug 2018 17:33:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwHL8oOtkNccM/PPkHQAr82l0XWcRXCOSlSznePkkKcjXUoBsPmI5iIWYOupZ09fCITyRFA X-Received: by 2002:a65:6455:: with SMTP id s21-v6mr28069067pgv.25.1535070807586; Thu, 23 Aug 2018 17:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535070807; cv=none; d=google.com; s=arc-20160816; b=LRFlG/nVU1FvDPuBkoWvHd6nQTrlI4uP/28tm0MtSXPCMT8n9dKV0ByTs/XUwNK4nY bh/I3HMFreHz9FM2bw7QoUuMNeSt6R+is8V5cTZfq1p0O1jybVK9E8JtCkWZ3rUhEfY4 Oe4x1vmOckd9+y5ngZCz/e/awTK7I0sueyhbwqEzFMAZV8c7zWD6UkIJiTzUdHuvv5r6 a5NmQzZ2bDuAfri4VUwMNYeXcbclvpkbjLLi/gA/IwdRB2kM7aj4tIV49W1hP4I892e+ ooQV6LAeNfgnlUt52j447T9jWnaTqHib5cM1Yk487gi01TAh0ZA+oBTu/gD6ro1zTttZ mu+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:date:mime-version:cc:to:from:subject:message-id :arc-authentication-results; bh=rZS0XJPLGZOQNPaqXTE3n0b1tAGn29C9J83fVHUdv+U=; b=vC4UsrUsOUKqnZoOpq7TZXekH+yu8d8ksEQv5wb0kN8DIKqWPWyxNdyDe/ljG/CyVY PLZmf7/nrF+OkapkV7qPzU+l3DRvDeI8KRjs9qXMq+vyJmo6+aDGAVgdOgKPcYAF/lbI imgDBghAP7y1kd74RSSeP3nSygQGbWhI2C0r97K22YjAPlEsmXduJJVbrb5vb4BrCz3a uosHRKuqBgherqPrbGWWd9IYOnsVIwJJsgAHZlR/eHhCeTo+SwG69whsPpVW7gvj+FCH zS6Yy6m4/g2/JkW/YLOw/LNrjO2qnMiI4E57B0IRrEOc33ZLStlz6xWLPQXy2DGopi2r uwyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si4876768pgm.51.2018.08.23.17.33.11; Thu, 23 Aug 2018 17:33:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbeHXEDP (ORCPT + 99 others); Fri, 24 Aug 2018 00:03:15 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:55360 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725266AbeHXEDP (ORCPT ); Fri, 24 Aug 2018 00:03:15 -0400 Received: from fsav404.sakura.ne.jp (fsav404.sakura.ne.jp [133.242.250.103]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w7O0V5VS019534; Fri, 24 Aug 2018 09:31:05 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav404.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav404.sakura.ne.jp); Fri, 24 Aug 2018 09:31:05 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav404.sakura.ne.jp) Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w7O0V5sS019530; Fri, 24 Aug 2018 09:31:05 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: (from i-love@localhost) by www262.sakura.ne.jp (8.15.2/8.15.2/Submit) id w7O0V5hT019529; Fri, 24 Aug 2018 09:31:05 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Message-Id: <201808240031.w7O0V5hT019529@www262.sakura.ne.jp> X-Authentication-Warning: www262.sakura.ne.jp: i-love set sender to penguin-kernel@i-love.sakura.ne.jp using -f Subject: Re: [PATCH] =?ISO-2022-JP?B?bW0scGFnZV9hbGxvYzogUEZfV1FfV09SS0VSIHRocmVh?= =?ISO-2022-JP?B?ZHMgbXVzdCBzbGVlcCBhdCBzaG91bGRfcmVjbGFpbV9yZXRyeSgpLg==?= From: Tetsuo Handa To: David Rientjes Cc: Michal Hocko , Tejun Heo , Roman Gushchin , Johannes Weiner , Vladimir Davydov , Andrew Morton , Linus Torvalds , linux-mm , LKML MIME-Version: 1.0 Date: Fri, 24 Aug 2018 09:31:05 +0900 References: In-Reply-To: Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Rientjes wrote: > On Fri, 24 Aug 2018, Tetsuo Handa wrote: > > > > For those of us who are tracking CVE-2016-10723 which has peristently been > > > labeled as "disputed" and with no clear indication of what patches address > > > it, I am assuming that commit 9bfe5ded054b ("mm, oom: remove sleep from > > > under oom_lock") and this patch are the intended mitigations? > > > > > > A list of SHA1s for merged fixed and links to proposed patches to address > > > this issue would be appreciated. > > > > > > > Commit 9bfe5ded054b ("mm, oom: remove sleep from under oom_lock") is a > > mitigation for CVE-2016-10723. > > > > "[PATCH] mm,page_alloc: PF_WQ_WORKER threads must sleep at > > should_reclaim_retry()." is independent from CVE-2016-10723. > > > > Thanks, Tetsuo. Should commit af5679fbc669 ("mm, oom: remove oom_lock > from oom_reaper") also be added to the list for CVE-2016-10723? > Commit af5679fbc669f31f ("mm, oom: remove oom_lock from oom_reaper") negated one of the two rationales for commit 9bfe5ded054b8e28 ("mm, oom: remove sleep from under oom_lock"). If we didn't apply af5679fbc669f31f, we could make sure that CPU resource is given to the owner of oom_lock by replacing mutex_trylock() in __alloc_pages_may_oom() with mutex_lock(). But now that af5679fbc669f31f was already applied, we don't know how to give CPU resource to the OOM reaper / exit_mmap(). We might arrive at direct OOM reaping but we haven't reached there... For now, I don't think we need to add af5679fbc669f31f to the list for CVE-2016-10723, for af5679fbc669f31f might cause premature next OOM victim selection (especially with CONFIG_PREEMPT=y kernels) due to __alloc_pages_may_oom(): oom_reap_task(): mutex_trylock(&oom_lock) succeeds. get_page_from_freelist() fails. Preempted to other process. oom_reap_task_mm() succeeds. Sets MMF_OOM_SKIP. Returned from preemption. Finds that MMF_OOM_SKIP was already set. Selects next OOM victim and kills it. mutex_unlock(&oom_lock) is called. race window like described as Tetsuo was arguing that at least MMF_OOM_SKIP should be set under the lock to prevent from races when the page allocator didn't manage to get the freed (reaped) memory in __alloc_pages_may_oom but it sees the flag later on and move on to another victim. Although this is possible in principle let's wait for it to actually happen in real life before we make the locking more complex again. in that commit.