Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4294187ybf; Wed, 4 Mar 2020 00:58:09 -0800 (PST) X-Google-Smtp-Source: ADFU+vvHHWYW2jEC5jxsiTd3lGwVkrrgvA1uTKtaX5tONZR854GrA3huN1V017sOhaFaCuEdZWGh X-Received: by 2002:aca:480c:: with SMTP id v12mr1042066oia.21.1583312279310; Wed, 04 Mar 2020 00:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583312279; cv=none; d=google.com; s=arc-20160816; b=JKfDqBNG5fvuwUDPKh2fHKKIB5z/msFZs5oSIxjheW3duzbU5nFeGVYMG8Ht1P1y/n 3nqekc1N+hj9djor2J4oPcJML9vCVOrpJrV4aBy8HR5vG/1OdREnpb9REHHhSmzA1Gjv PgP7LHQJ2fKXm+TUpITPryzBpasqcg3ncLV+hv6KpBWmAovsgT4RcGqqZc5LbW23tjac c8pYWUNWZIk7HBKwlTwsGogv2RfFJGtUxk4EHRwuIsKwGiKWRYd/esP3oYNR6TNhp13r nBFgwEJAwYPkIMpFuSzeUyz3nbEDKPmCF7zT0ipS2Ps1/fguHJZn9V8qkUXJuHBuiztz Drdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from; bh=Tc9TJ8J1TA0AjXza0sJaEwRZR579WXLNRHqjv6fqQfY=; b=muX1HWNM60ZGzQO9iySf0OrRuU4aLnDubsjFavimg0/FOixYjv0rZ3RFim6IhsNdJJ ramM4rJUnquR0NlbRaI6ZZUFoe62Dn+IGhhKRg4B31Ub4E68OpKq9XtO7baLdTWNbIBj fBuJXYeS8lMzf0WQwaC1lIovH5CNaVQ6MYVuq8+I77HwiY2LRmA5UOaV1kf1poSkHhXW CYTvumBJ2d419JYTmEe8CQT1PimNpM85QjGjTCNSMa9Ch6TFT/AQxJoZeh9qqxk2/aAR 9yCDwokVlzbRHQ+2dEe8tBrbd/vniMm9HBc5yCNFgdsIQw4kJfhEGPrloD59PelFA2SY 6ZDA== 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 g17si521749ots.153.2020.03.04.00.57.47; Wed, 04 Mar 2020 00:57:59 -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; 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 S2387732AbgCDI4m (ORCPT + 99 others); Wed, 4 Mar 2020 03:56:42 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:46279 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727734AbgCDI4m (ORCPT ); Wed, 4 Mar 2020 03:56:42 -0500 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j9PpX-00079c-Lj; Wed, 04 Mar 2020 09:56:39 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id D9DFD101161; Wed, 4 Mar 2020 09:56:37 +0100 (CET) From: Thomas Gleixner To: "Eric W. Biederman" , Qian Cai Cc: oleg@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH timers/core] posix-cpu-timers: Put the task_struct in posix_cpu_timers_create In-Reply-To: <877e00hf08.fsf@x220.int.ebiederm.org> Date: Wed, 04 Mar 2020 09:56:37 +0100 Message-ID: <87wo80lcqi.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ebiederm@xmission.com (Eric W. Biederman) writes: > Qian Cai writes: >> The recent commit removed put_task_struct() in posix_cpu_timer_del() >> results in many memory leaks like this, >> >> unreferenced object 0xc0000016d9b44480 (size 8192): >> comm "timer_create01", pid 57749, jiffies 4295163733 (age 6159.670s) >> hex dump (first 32 bytes): >> 02 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................ >> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ >> backtrace: >> [<0000000056aca129>] copy_process+0x26c/0x18e0 >> alloc_task_struct_node at kernel/fork.c:169 >> (inlined by) dup_task_struct at kernel/fork.c:877 >> (inlined by) copy_process at kernel/fork.c:1929 >> [<00000000bdbbf9f8>] _do_fork+0xac/0xb20 >> [<00000000dcb1c445>] __do_sys_clone+0x98/0xe0 >> __do_sys_clone at kernel/fork.c:2591 >> [<000000006c059205>] ppc_clone+0x8/0xc >> ppc_clone at arch/powerpc/kernel/entry_64.S:479 >> > > I forgot that get_task_for_clock called by posix_cpu_timer_create > returns a reference to a task_struct. Put that reference > to avoid the leak. I took the liberty to fold this back into the affected commit and add a comment why this put_task_struct() is actually required. Thanks, tglx