Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3840072imm; Mon, 6 Aug 2018 11:28:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9NGHm8Mliz6FgWDBFtHUXKAuiLRFSbPsZUhoA46sfRtEKZyMxzC94bNNSIlHvjgEunXWe X-Received: by 2002:a17:902:4403:: with SMTP id k3-v6mr14648389pld.243.1533580099910; Mon, 06 Aug 2018 11:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533580099; cv=none; d=google.com; s=arc-20160816; b=KwrRJC9Favxe6e+D/bW5alXBnmic9GNoZAPiVggDv4XUKDMNOIiZsvlYhcj7gdYKpX uBoAMTL2dvy8P7/F/MtKmTv0PRkWNFo9GG0p7ps+OuLv3RKmAvCCMj5weGaZYJkGxSVB CDh/QOck9ugt62TGiQI9Pe6DLUWSbsXuN6ZzxvRSrI1MoeT0GY9croC7sWn5/vhm2Z+L eOLDwq5BixSAEoI9n6+CtlU1lYxZbsm24hL1CWilE/8aQ7fjsLCmrwlrAnV3GZrrBCi3 PfGab0EFYQlEX8qQr0TN+Cc3ZzU3pQq8T4R7MhNB23IMfWqu3kQ+z+Njw6p75PUMVJiT oSLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xGBBRuO4Az4XOP88JUEmza0ZAmRRe18j30BmsSCVyn0=; b=S4CFslO2FfgAbKx0/ZxbqW0W8nVmEVoOPPDCok2gJp0rGMS0tNuOQZD/YnXbFAxwDE KGbbKtW8JCQTAA6EhsQCtMvA/MbYbS0yejyTdEyvzJjwreqk+5BQgr9R63Wr/0nttbqM MKUznEM/+lBEVfRnRAKF/7RzIWgQ/5nVHBjnfNaaUgxdk4zK5oQG/SGfW6SGm2CGUUlU otKKxWJEOrR+Uk358xUT25Vx147aGAi+nIavkRFXL7XzCORyyZztJ7HAZKNNhB0ZnEvx 9/MEFAwlpxYLTRylMUEBcWeiA75sSbVZM44QZBwcXnEj7wal30i5htx/9vXFUFpIPU95 AUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pF56GvQ3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i124-v6si14485825pfc.110.2018.08.06.11.28.04; Mon, 06 Aug 2018 11:28:19 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=pF56GvQ3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733067AbeHFT7s (ORCPT + 99 others); Mon, 6 Aug 2018 15:59:48 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41307 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732994AbeHFT7r (ORCPT ); Mon, 6 Aug 2018 15:59:47 -0400 Received: by mail-pf1-f193.google.com with SMTP id y10-v6so7215733pfn.8 for ; Mon, 06 Aug 2018 10:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xGBBRuO4Az4XOP88JUEmza0ZAmRRe18j30BmsSCVyn0=; b=pF56GvQ31KVDbGqYFbDoIbhjkMlQHxp8x5J9qX4Gh1pDvF/WXsaiQkNwGvL6+0ygLu M1nwGQCBC4k6JdxMq8Fgk9FR2a3RK0N/ipRp4MOD5IfE9ElkcOdCZjPnPQ8wyBuoooks BmnK0M5IlN/sjejbcxWA3t0hT/W/YkwN+8jqzGWt/qxbTxLyU/isvTLhF3Mzh3OHc56h IucjTm9ejTlz/czitWSkS18rxLB80RBSmK0sfAW6t/+N2oJhsCwnfas1O4tH3TdY/krj AnP2Afm0RftLGXna17rdKjZ8B0SXHaeKiPDQ8VdFSBLx6pu+s8Mn1C2ofbwoJziAgIeH 24oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xGBBRuO4Az4XOP88JUEmza0ZAmRRe18j30BmsSCVyn0=; b=ulMnI0oZ9Slo1CNMT2d7qFsHGsy/+lbPUo75SUPie6FooCrLhaELuu06QhVxtQwUbR crrhpIZe75L1L6tXROgf0Galp4vpkRAD2FD4SsmnADooeThYl9+xXsKGQE1qq60Kxl84 W8oWD+zsP1vwo3QJUyI5Icoy5SoOU+8iqvvx86ZFevAmwUjiPd5OI0ScyE0mPwIMdgDG u036uQHtbt5Aw5dbgccPvSTbDiLncq5JoPxwbp3/InEuzKx6/aQC3yfM1CM27mPFnrB7 ZMWaZxumBhKYzDHXP9zDa66HhXyp8oB7Y770Wqu6XS6W6sErIjjI9aGbunMtVOaiSFAP YiMQ== X-Gm-Message-State: AOUpUlE80m7zswFL2NmHg0QA7PgV0xARAgg8t0HVsWUzIj1Msj2Ksolj Wj6Dwfgbn3LfX5L1fh9aZlTrgL0XRKUMXp5z9xYxJA== X-Received: by 2002:a62:3184:: with SMTP id x126-v6mr18305702pfx.49.1533577777348; Mon, 06 Aug 2018 10:49:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:ac14:0:0:0:0 with HTTP; Mon, 6 Aug 2018 10:49:16 -0700 (PDT) In-Reply-To: <20180806174410.GB10003@dhcp22.suse.cz> References: <0000000000006350880572c61e62@google.com> <20180806174410.GB10003@dhcp22.suse.cz> From: Dmitry Vyukov Date: Mon, 6 Aug 2018 19:49:16 +0200 Message-ID: Subject: Re: WARNING in try_charge To: Michal Hocko Cc: syzbot , cgroups@vger.kernel.org, Johannes Weiner , LKML , Linux-MM , Tetsuo Handa , syzkaller-bugs , Vladimir Davydov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 6, 2018 at 7:44 PM, Michal Hocko wrote: > On Mon 06-08-18 08:42:02, syzbot wrote: >> Hello, >> >> syzbot has tested the proposed patch but the reproducer still triggered >> crash: >> WARNING in try_charge >> >> Killed process 6410 (syz-executor5) total-vm:37708kB, anon-rss:2128kB, >> file-rss:0kB, shmem-rss:0kB >> oom_reaper: reaped process 6410 (syz-executor5), now anon-rss:0kB, >> file-rss:0kB, shmem-rss:0kB >> task=syz-executor5 pid=6410 invoked memcg oom killer. oom_victim=1 > > Thank you. This is useful. The full oom picture is this > : [ 65.363983] task=syz-executor5 pid=6415 invoked memcg oom killer. oom_victim=0 > [...] > : [ 65.920355] Task in /ile0 killed as a result of limit of /ile0 > : [ 65.926389] memory: usage 0kB, limit 0kB, failcnt 20 > : [ 65.931518] memory+swap: usage 0kB, limit 9007199254740988kB, failcnt 0 > : [ 65.938296] kmem: usage 0kB, limit 9007199254740988kB, failcnt 0 > : [ 65.944467] Memory cgroup stats for /ile0: cache:0KB rss:0KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:0KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB > : [ 65.963878] Tasks state (memory values in pages): > : [ 65.968743] [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name > : [ 65.977615] [ 6410] 0 6410 9427 532 61440 0 0 syz-executor5 > : [ 65.986647] Memory cgroup out of memory: Kill process 6410 (syz-executor5) score 547000 or sacrifice child > : [ 65.996474] Killed process 6410 (syz-executor5) total-vm:37708kB, anon-rss:2128kB, file-rss:0kB, shmem-rss:0kB > : [ 66.007471] oom_reaper: reaped process 6410 (syz-executor5), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB > : [ 66.017652] task=syz-executor5 pid=6410 invoked memcg oom killer. oom_victim=1 > : [ 66.025137] ------------[ cut here ]------------ > : [ 66.029927] Memory cgroup charge failed because of no reclaimable memory! This looks like a misconfiguration or a kernel bug. > : [ 66.030061] WARNING: CPU: 1 PID: 6410 at mm/memcontrol.c:1707 try_charge+0x734/0x1680 > > So we have only a single task in the memcg and it is this task which > triggers the OOM. It gets killed and oom_reaped. This means that > out_of_memory should return with true and so we should retry and force > the charge as I've already mentioned. For some reason this task has > triggered the oom killer path again and then we haven't found any > eligible task and resulted in the warning. This shouldn't happen. > > I will stare to the code some more to see how the heck we get there > without passing > if (unlikely(tsk_is_oom_victim(current) || > fatal_signal_pending(current) || > current->flags & PF_EXITING)) > goto force; This is the syzkaller reproducer if it will give you any hints: mkdir(&(0x7f0000000340)='./file0\x00', 0x0) mount(&(0x7f00000000c0)='./file0//ile0\x00', &(0x7f0000000080)='./file0\x00', &(0x7f0000000200)='cgroup2\x00', 0x0, 0x0) r0 = open(&(0x7f0000000040)='./file0//ile0\x00', 0x0, 0x0) r1 = openat$cgroup_procs(r0, &(0x7f00000001c0)='cgroup.procs\x00', 0x2, 0x0) write$cgroup_pid(r1, &(0x7f0000000100), 0x12) syz_mount_image$xfs(&(0x7f0000000280)='xfs\x00', &(0x7f00000002c0)='./file0//ile0\x00', 0x0, 0x0, &(0x7f0000000740), 0x0, &(0x7f0000000800)) getsockopt$sock_cred(r0, 0x1, 0x11, &(0x7f0000000180), &(0x7f0000000240)=0xc) r2 = open(&(0x7f0000000040)='./file0//ile0\x00', 0x0, 0x0) write$FUSE_STATFS(r2, &(0x7f0000000280)={0x60, 0xfffffffffffffffe, 0x7, {{0x401, 0x7, 0x7d, 0x1c, 0xd8, 0xb7, 0x2, 0x3}}}, 0x60) r3 = openat$cgroup_int(r2, &(0x7f00000001c0)='memory.max\x00', 0x2, 0x0) write$cgroup_int(r3, &(0x7f00000000c0), 0x12)