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; }