Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp270521imu; Thu, 3 Jan 2019 19:27:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xdy2iPXKlgKys9SXieYjIE8Rcuud7fWJw3GNVKMu4d1JSbpww3tNaS4ZdXWK1i4oSs3GHX X-Received: by 2002:aa7:810c:: with SMTP id b12mr50410915pfi.44.1546572477659; Thu, 03 Jan 2019 19:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546572477; cv=none; d=google.com; s=arc-20160816; b=opa0F5fPEJ48bfkSAp5BcVRZPeUeMkN3D4HR1jyn4n3KYLzxoY/a9r0H8+9hJUKUMN xlIJ0BzFjuZC3kShW+cohy8/emr5/cXNdWFytMo0haAZ0VqHbaMIBWzi7Uj555/TBNdk fitT3kwsNT2VEfLGYmsq3b3Uawhn50vuN3hP0dO+8WDa863GotaL3EpJTLfV9n2d0bAQ lGb9eL1nliozojaM9Ai+AdOeBWyoFmQ6TjfDSs6DVitbQL7sky7jHVZ1veUEQxmxT1tE bex/GYvGcmm0h5C+GXLSbDS7N2T2nsdbivMFVXkmv3ZAeb1khRB8CVkmPCWHT/V8+xGK Boig== 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 :in-reply-to:references:mime-version:dkim-signature; bh=OmllRMdyJnbmtqXjx8n3a2o3oNHbW/WUJayH7xChrWo=; b=RvgM2z/AnykaYYyDtHkFMfEe8fPE040Osat3khXyidnphcNUc1n6Pj8vv9EY+fH2gF sIKmprI0EjRBD2cg5zajJ3IPrcTtcYNkEe5nXThpbSsf6NDe+24RJuBnhLefibF1+3Fy 7CT0Opuw+q1yhfR51c4IGUaGsZ5wO0/eoxyQWRpgPe3fhgFHfd8+uuoM1MKDuE6a+5Y+ VwJS5ROEox2wIyKUrMADhj+wJL/81TjcuU2pYrY9gfZd0LtDjCvMg7589Phw76lxCUj9 OAh3LWgco/J0LxE6/UF0UiZ7W+Yhqs1hahupPqFNPmrSXSFU4u32Q2SqksHAqvF1l0mS clPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uGajQCg+; 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 p66si22790981pfp.144.2019.01.03.19.27.42; Thu, 03 Jan 2019 19:27:57 -0800 (PST) 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=uGajQCg+; 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 S1728451AbfACWTK (ORCPT + 99 others); Thu, 3 Jan 2019 17:19:10 -0500 Received: from mail-yb1-f170.google.com ([209.85.219.170]:43364 "EHLO mail-yb1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728379AbfACWTK (ORCPT ); Thu, 3 Jan 2019 17:19:10 -0500 Received: by mail-yb1-f170.google.com with SMTP id t16so12358147ybk.10 for ; Thu, 03 Jan 2019 14:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OmllRMdyJnbmtqXjx8n3a2o3oNHbW/WUJayH7xChrWo=; b=uGajQCg+aFzz+jSS/1j66aNVb1Uhr9Y9FqzhjpEv6zwqkzNUsSEz0MXXDJzlolZpL5 yOpqMAz/qYTeYQGLKg9Rs+lPNzs18AM80Hpw4VF/KDDBVGXsRDIu7PukKycJZ0tY75Pj QsxR1y0SWjJHeJjohlfaYdddn3PtyHlaU3Al1s8p+amXSQlJBTGQLFawdrWlYChMdOHS 45BwDzzFPv5uz+GDu2wwJnJdtyFB7NA/hLMtZVDhH7jH17H/wcpj4+8HqFVZpCYowCKO HeowZqtxuRFIwLHojY0kRxEob3jVpLHVFuFOX2LFDc9ySb98+D6eTjlxmeQ9cnVQ4fIf EfuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OmllRMdyJnbmtqXjx8n3a2o3oNHbW/WUJayH7xChrWo=; b=bvK/LctluEOMF5Vtv5UldcPBwT1v+ObPtefxURs9eBZaLe4qbFzD3jKvjX+d3+kQfp wepjNNzB4w8GNa/8F7OgpfUfns907QlDrBCK5wvl+hT+PfxWDuev5DwzUiAE2SxKx/N7 LMuAX7Kj5HulFFQikH33cglgOyVIBVrra1HanRIWvSTJFdHJhAU1n9At3BXkJjp+QJnL hDmZzwHp7YcnT+z1rwChIrefWEryn6Dsc8PBhmICjaShfnlwRd+3r8w+EpinL93cdD7J 1Ro8DN1qVjxZ9JLzh2/DVaLUn5wpSyBbEr0SIVJiyPlEJXMdS6LPpUhfwg9sFMxwlWyQ orbA== X-Gm-Message-State: AJcUukd1gwnTvyRRcD/qtuv+D8l3XaNpAmc0vMGWTNfBU3EmWKjvbvca z5abmuLbdYbRPxB84kA5em3qytrMkWPu7LInBIhjpZAhDHJrqA== X-Received: by 2002:a25:a269:: with SMTP id b96mr20156330ybi.148.1546553948330; Thu, 03 Jan 2019 14:19:08 -0800 (PST) MIME-Version: 1.0 References: <00000000000051ee78057cc4d98f@google.com> <87614226-e895-c3a3-3626-b0fbe7e191be@colorfullife.com> In-Reply-To: From: Shakeel Butt Date: Thu, 3 Jan 2019 14:18:57 -0800 Message-ID: Subject: Re: general protection fault in put_pid To: Manfred Spraul Cc: Dmitry Vyukov , syzbot+1145ec2e23165570c3ac@syzkaller.appspotmail.com, Andrew Morton , David Howells , "Eric W. Biederman" , ktsanaktsidis@zendesk.com, LKML , Michal Hocko , Mike Rapoport , Stephen Rothwell , syzkaller-bugs , Matthew Wilcox , Davidlohr Bueso 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 Hi Manfred, On Sun, Dec 23, 2018 at 4:26 AM Manfred Spraul wrote: > > Hello Dmitry, > > On 12/23/18 10:57 AM, Dmitry Vyukov wrote: > > > > I can reproduce this infinite memory consumption with the C program: > > https://gist.githubusercontent.com/dvyukov/03ec54b3429ade16fa07bf8b2379aff3/raw/ae4f654e279810de2505e8fa41b73dc1d77778e6/gistfile1.txt > > > > But this is working as intended, right? It just creates infinite > > number of large semaphore sets, which reasonably consumes infinite > > amount of memory. > > Except that it also violates the memcg bound and a process can have > > effectively unlimited amount of such "drum memory" in semaphores. > > Yes, this is as intended: > > If you call semget(), then you can use memory, up to the limits in > /proc/sys/kernel/sem. > > Memcg is not taken into account, an admin must set /proc/sys/kernel/sem. > > The default are "infinite amount of memory allowed", as this is the most > sane default: We had a logic that tried to autotune (i.e.: a new > namespace "inherits" a fraction of the parent namespaces memory limits), > but this we more or less always wrong. > > What's the disadvantage of setting the limits in /proc/sys/kernel/sem high and let the task's memcg limits the number of semaphore a process can create? Please note that the memory underlying shmget and msgget is already accounted to memcg. thanks, Shakeel