Received: by 10.223.176.46 with SMTP id f43csp905474wra; Sat, 20 Jan 2018 07:03:23 -0800 (PST) X-Google-Smtp-Source: AH8x224+94tYctVmdltNwBahyJ2C1UbD5J80kxxp2MwvUKILB40OiS9lfMEdd3Q0/wgnP09VmOTM X-Received: by 10.99.114.28 with SMTP id n28mr2206077pgc.86.1516460603502; Sat, 20 Jan 2018 07:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516460603; cv=none; d=google.com; s=arc-20160816; b=v1jZqQUMcebrTNM0al/0QCDDX22eagA6DQCr6GZ42oNsPBedHcszHpsg/X+t+RBuFK y/eocVGWV+T8x9bumeHRZy8LQA67BiHgvnuhEI8k+GaQXJrDTtl4XxnBrchfe2bJ2lXy UT01r2LUhq9TocfCyaj1g/bmkme18Shl3Th/haXwMJNeKKmZhwe93TCUaS+PsyBtJpN8 hipg+2iTrae/PEPum3FZMQU4+RtYD65HWoGTGm9z1QbUBeyaHkXDS8zr88xDFkd2FNWx OXiNJyS7hrOKGORdK/sRY/F/v0Ww+nKk2P4Vimx/3t/z1W3GShT+HsSEmQJaUsYROikk 1XjA== 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:arc-authentication-results; bh=1F7GTEwN2MG7NmPjlMGt5h9OnY0Md8wrZSP4waKMLv8=; b=l9NCqYuewzisafRykXfvYmrl5sUF4JuuXtyzAoAQQL2LHwbLci/F7gEvWMnF3dfY/S WIciicZiThxR/8Rg08j8wGfD/8UKFiiJ/1y3tVsI0zcWHtICd9EIOjxzWhDib0D15t20 k29UhOMY1DkgEHsjHL7QCfi9hytyTsJyf5f3wE+TBmVldEfNyLJgbzV2dqKAI7qZyo/i 7PQu9G8ZUpkYteUO8nXkxRZmT+WIUzJcjc+dDYkC63//Ns53eIGQIDxNI8IV+87k5tcj Hm2tI2GlHsuCop0DlwZGZxvqliw2Th8mNh/OxopGZKLqdLgeHTolIHxruTO7FyHV7omO QNbg== 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 n127si6390999pga.376.2018.01.20.07.03.08; Sat, 20 Jan 2018 07:03:23 -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 S1755527AbeATPBm (ORCPT + 99 others); Sat, 20 Jan 2018 10:01:42 -0500 Received: from outprodmail01.cc.columbia.edu ([128.59.72.39]:56018 "EHLO outprodmail01.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754051AbeATPBg (ORCPT ); Sat, 20 Jan 2018 10:01:36 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id w0KEw7WB047811 for ; Sat, 20 Jan 2018 10:01:35 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id 083FE6D for ; Sat, 20 Jan 2018 10:01:36 -0500 (EST) Received: from sendprodmail04.cc.columbia.edu (sendprodmail04.cc.columbia.edu [128.59.72.16]) by hazelnut (Postfix) with ESMTP id DD4086D for ; Sat, 20 Jan 2018 10:01:35 -0500 (EST) Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by sendprodmail04.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id w0KF1Ypc008311 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 20 Jan 2018 10:01:35 -0500 Received: by mail-wr0-f199.google.com with SMTP id y13so3288009wrb.17 for ; Sat, 20 Jan 2018 07:01:34 -0800 (PST) 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=1F7GTEwN2MG7NmPjlMGt5h9OnY0Md8wrZSP4waKMLv8=; b=H+cgHr9datHfeFQ6tk/QQEdtHXE6sGhxctfxwwyliQhZbg3w7a87NjCCoN5ptx4G9m IrYcrLf7zbI23ZFSDskP92WCSASYvdJSds9sa4x5binBFqywmwlzIS1pEK9TOzqToegw 08bRAi8ao9r4WEILkbCtwN0mye9mKC2jwg3j7/sJG5Ee5YVB5cJEZ9uO51IJOUcBzhP3 iR+gKVf8Hm1Gn/5WCJ3DNmMZ8FSrOGac35uT/o2xS0CLXpbL+O0euZ3stYgljVXJUuKB K+BPbWZRjvvvh0fqVEkru6Ss1se/IPA6Mz/bZfn3SyF6Dj3NRyOjlvied9Zquoh+OQPm 7MLQ== X-Gm-Message-State: AKwxytcbJXmh/Sm81yBHQ66ML8TKCtIH6lHePO5yuniJXHPwAPaGkg9E 1MH18DdkN4ItOAqmmq2Gg27SEy++8NetpE8r/fhZE05GLdoZQVlUlbdz1Eyf/BRebCNAzeekzbR j8NbQfeHettzzNuBExni5QVRjeKhnhuBUrebse7zkY/cQrqzT X-Received: by 10.80.179.6 with SMTP id q6mr3936972edd.87.1516460494244; Sat, 20 Jan 2018 07:01:34 -0800 (PST) X-Received: by 10.80.179.6 with SMTP id q6mr3936924edd.87.1516460493822; Sat, 20 Jan 2018 07:01:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.241.82 with HTTP; Sat, 20 Jan 2018 07:01:33 -0800 (PST) In-Reply-To: References: From: Shankara Pailoor Date: Sat, 20 Jan 2018 07:01:33 -0800 Message-ID: Subject: Re: Possible Memory Leak in KCOV Linux 4.15-rc1 To: Dmitry Vyukov Cc: LKML , syzkaller Content-Type: text/plain; charset="UTF-8" X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.78 on 128.59.72.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, I will try and get something to you tomorrow. Just wondering, but what happens to the old struct kcov if a task opens /sys/kernel/debug/kcov twice? I am looking here https://elixir.free-electrons.com/linux/v4.15-rc8/source/kernel/kcov.c#L381 and I don't see where the previous struct would get freed. Regards, Shankara On Sat, Jan 20, 2018 at 4:38 AM, Dmitry Vyukov wrote: > On Fri, Jan 19, 2018 at 8:29 PM, Shankara Pailoor wrote: >> Hi Dmitry, >> >> I added support for kcov in strace and I have been tracing a fairly >> large program but after a little while, I notice that when I mmap a >> new cover buffer, the call fails with ENOMEM. After killing the >> program, I try and rerun and I notice that there is nearly no memory >> on the system. When I do a kmemleak scan I get the following reports: >> >> I believe the problem occurs when I try and setup the kcov buffer >> again after an exec. Instead of reusing the old file descriptor I open >> kcov again within that process. In that case, I don't know what >> happens to the old kcov struct. >> >> I don't see a maintainers list for kcov so I decided to email you >> directly. Let me know what more information I can provide. > > > Hi Shankara, > > Looks bad. Can you provide a reproducer? > We extensively use kcov with syzkaller, but have not observed such > leaks. Also I don't see anything obvious in the code. > > Thanks