From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 0C7C7828E1 for ; Tue, 5 Jul 2016 07:41:12 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id a69so443112668pfa.1 for ; Tue, 05 Jul 2016 04:41:12 -0700 (PDT) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com. [119.145.14.66]) by mx.google.com with ESMTPS id o129si3823328pfb.247.2016.07.05.04.41.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Jul 2016 04:41:11 -0700 (PDT) Message-ID: <577B9CC5.3090404@huawei.com> Date: Tue, 5 Jul 2016 19:40:53 +0800 From: Xishi Qiu MIME-Version: 1.0 Subject: is pid_namespace leak in v3.10? Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: oleg@redhat.com, ebiederm@xmission.com Cc: Linux MM , LKML I find pid_namespace leak by "cat /proc/slabinfo | grep pid_namespace". The kernel version is RHEL 7.1 (kernel v3.10 stable). The following is the test case, after several times, the count of pid_namespace become very large, is it correct? I also test mainline, and the count will increase too, but it seems stably later. BTW, this patch doesn't help. 24c037ebf5723d4d9ab0996433cee4f96c292a4d exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting Thanks, Xishi Qiu #include #include #include #include #include #include #include #ifndef CLONE_NEWPID #define CLONE_NEWPID 0x20000000 #endif void test(void) { printf("clone child\n"); exit(0); } int main() { pid_t pid, child_pid; int i, status; void *stack; for (i = 0; i < 100; i++) { stack = malloc(8192); pid = clone(&test, (char *)stack + 8192, CLONE_NEWPID|SIGCHLD, 0); } sleep(5); return 0; } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755180AbcGELlO (ORCPT ); Tue, 5 Jul 2016 07:41:14 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:33576 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755168AbcGELlG (ORCPT ); Tue, 5 Jul 2016 07:41:06 -0400 Message-ID: <577B9CC5.3090404@huawei.com> Date: Tue, 5 Jul 2016 19:40:53 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: , CC: Linux MM , LKML Subject: is pid_namespace leak in v3.10? Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.577B9CCB.01D6,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: db7ba432cec8cc9b9fc87f989793d5b5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I find pid_namespace leak by "cat /proc/slabinfo | grep pid_namespace". The kernel version is RHEL 7.1 (kernel v3.10 stable). The following is the test case, after several times, the count of pid_namespace become very large, is it correct? I also test mainline, and the count will increase too, but it seems stably later. BTW, this patch doesn't help. 24c037ebf5723d4d9ab0996433cee4f96c292a4d exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting Thanks, Xishi Qiu #include #include #include #include #include #include #include #ifndef CLONE_NEWPID #define CLONE_NEWPID 0x20000000 #endif void test(void) { printf("clone child\n"); exit(0); } int main() { pid_t pid, child_pid; int i, status; void *stack; for (i = 0; i < 100; i++) { stack = malloc(8192); pid = clone(&test, (char *)stack + 8192, CLONE_NEWPID|SIGCHLD, 0); } sleep(5); return 0; }