Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1216631ybh; Sat, 3 Aug 2019 20:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXQvUGQVQiheEUyzL9jEd6pIZWW+f1Z9BGeZgHGSihM2kpGaMTvCbJ0H8n3N9euKsILtYG X-Received: by 2002:a17:902:8509:: with SMTP id bj9mr139839791plb.79.1564890680408; Sat, 03 Aug 2019 20:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564890680; cv=none; d=google.com; s=arc-20160816; b=bf6LJNm1QWLMGaa1xYO2apC8fhzDsBBFeGHns+hrVir99icM2/I3+8TH7fxpIKLYYm G/M+iJOc+XyEMGl+m2Kz/TQiRoGNcUga4eD+n5R4FhXrCxcPW2nDswu6vMd2HwgKnMzC BqnakcjOhavsPs0iHF4RrHIIfnVKhdMPRJuoUsTwwsJFA40vlbDva6WqPQr66X2gCloG qBFzkdVgyE69FmRm6dS8blXLfKkNQgdlJD/pqn5ro1OYL9SMRF1jTyW9lJQovtDYnWfX o95cdu+5Tj5028eHmsi1OjTARN1+iRSn9zltSnQj7Gdn467oXSkTdP6OyGY4OwCkSv8T mYWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:references:to:from:subject; bh=pCfohYs8T32A19JLY6vISbISUxroBlfym93fGYfRr+E=; b=u+68tML3w4uofSxh3CNTvXxDpp/j49B5aPm4xOQmf0ADB3kBs0O59bQ37CUtMBGObm dOr3DoJILX96lbdiwwIeLbcjGZTBko9XrEtOAjCHzPETMzD4AYusy8XDTNU3XT43voxX PNBwOAxrozB27tZexYnQO3kVOkcAPevru+zMIJGQUr7hla2lhpjQdp84rW3cuqvu1E0q koPA8WSgjoNIYYh6jC4xcETn+gEUEYx/ZBdRlSzUNHcqBolHgy4y25zOV0Nd8wFLHXiY gsJNxz2He1+v5pRquyFPtD8zTa1n12pIzaaIgRyxzrorgAnvfkmyhkqO/O+8Ae6wJA7D jVRg== 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 x22si38612381pln.150.2019.08.03.20.51.05; Sat, 03 Aug 2019 20:51:20 -0700 (PDT) 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 S2389873AbfHCOWV (ORCPT + 99 others); Sat, 3 Aug 2019 10:22:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42864 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387961AbfHCOWU (ORCPT ); Sat, 3 Aug 2019 10:22:20 -0400 Received: by mail-wr1-f67.google.com with SMTP id x1so30161444wrr.9 for ; Sat, 03 Aug 2019 07:22:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pCfohYs8T32A19JLY6vISbISUxroBlfym93fGYfRr+E=; b=AXhHfC1tm+QX/DkuNbWYsTjgpxASutqA+u/VxrmHuZ1jdkrBnEmT4/LqlpkaWGHkFB ZYUnucQlG9b8gV2/oNbiSuBK8RXsUZ37+FFWrgysRtXtXHIHIcsdcPFlnZFZmHamTEZZ 80iw2ArHmMAI50p7n333RZziq1WDoEiJ0GiL2/HMrgKQQzQxUecC5aCqIE1J8Jldp+uN vJD3+K2Ap2N8dHiVLXqbrMHn9DTfPOR2SRqHU3Tt/Uom6X9t9DyP0y6bGCiSi+rVeU0L lS36f7xPL8cM0iSllv+5934pKfSGUyXyWHViq/fiWIlbiHNnn2UepjhIA7iCYIZqev4P tB0A== X-Gm-Message-State: APjAAAUpk095Qw/G/R7KP2qrx6R7UuVLiDnVAkxgw8s5fv3d35F8Bk/S TiyhR154CZs25t7cG+WpEMKEOZ0fhlU= X-Received: by 2002:a5d:4e08:: with SMTP id p8mr4291441wrt.20.1564842137832; Sat, 03 Aug 2019 07:22:17 -0700 (PDT) Received: from ?IPv6:2a0b:e7c0:0:107::49? ([2a0b:e7c0:0:107::49]) by smtp.gmail.com with ESMTPSA id v65sm91701974wme.31.2019.08.03.07.22.16 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 03 Aug 2019 07:22:17 -0700 (PDT) Subject: Re: memory leak in pty_common_install From: Jiri Slaby To: syzbot , syzkaller-bugs@googlegroups.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org References: <0000000000002cd2b1058ee760fe@google.com> <9ad9f8ee-4674-9665-1de5-001268d922bf@suse.cz> Openpgp: preference=signencrypt Autocrypt: addr=jslaby@suse.cz; prefer-encrypt=mutual; keydata= mQINBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL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6Z6uH/xGE8pG5NbGtd02r+m7SfuEDoG3Hs1iMGecPyV XxCVvSV6dwRQFc0UOZ1a6ywwCWfGOYqFnJvfSbUiCMV8bfRSWhnNQYLIuSv/nckyi8CzCYIg c21cfBvnwiSfWLZTTj1oWyj5a0PPgGOdgGoIvVjYXul3yXYeYOqbYjiC5t99JpEeIFupxIGV ciMk6t3pDrq7n7Vi/faqT+c4vnjazJi0UMfYnnAzYBa9+NkfW0w5W9Uy7kW/v7SffH/2yFiK 9HKkJqkN9xYEYaxtfl5pelF8idoxMZpTvCZY7jhnl2IemZCBMs6s338wS12Qro5WEAxV6cjD VSdmcD5l9plhKGLmgVNCTe8DPv81oDn9s0cIRLg9wNnDtj8aIiH8lBHwfUkpn32iv0uMV6Ae sLxhDWfOR4N+wu1gzXWgLel4drkCJcuYK5IL1qaZDcuGR8RPo3jbFO7Y Message-ID: <0e43eb9e-e69d-b2a5-b98e-8dd3b9b030d2@suse.cz> Date: Sat, 3 Aug 2019 16:22:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9ad9f8ee-4674-9665-1de5-001268d922bf@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02. 08. 19, 8:23, Jiri Slaby wrote: > On 30. 07. 19, 17:08, syzbot wrote: >> Hello, >> >> syzbot found the following crash on: >> >> HEAD commit:    6789f873 Merge tag 'pm-5.3-rc2' of >> git://git.kernel.org/pu.. >> git tree:       upstream >> console output: https://syzkaller.appspot.com/x/log.txt?x=1696897c600000 >> kernel config:  https://syzkaller.appspot.com/x/.config?x=339b6a6b3640d115 >> dashboard link: >> https://syzkaller.appspot.com/bug?extid=bdebcbf44250d75bdd82 >> compiler:       gcc (GCC) 9.0.0 20181231 (experimental) >> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=153d7544600000 >> >> IMPORTANT: if you fix the bug, please add the following tag to the commit: >> Reported-by: syzbot+bdebcbf44250d75bdd82@syzkaller.appspotmail.com >> >> BUG: memory leak >> unreferenced object 0xffff88810d84d400 (size 512): >>   comm "syz-executor.5", pid 7522, jiffies 4294954305 (age 14.260s) >>   hex dump (first 32 bytes): >>     50 d4 84 0d 81 88 ff ff e0 ff ff ff 0f 00 00 00  P............... >>     10 d4 84 0d 81 88 ff ff 10 d4 84 0d 81 88 ff ff  ................ >>   backtrace: >>     [<000000003d61da44>] kmemleak_alloc_recursive >> include/linux/kmemleak.h:43 [inline] >>     [<000000003d61da44>] slab_post_alloc_hook mm/slab.h:522 [inline] >>     [<000000003d61da44>] slab_alloc mm/slab.c:3319 [inline] >>     [<000000003d61da44>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548 >>     [<00000000a6239e0a>] kmalloc include/linux/slab.h:552 [inline] >>     [<00000000a6239e0a>] pty_common_install+0x4e/0x2b0 >> drivers/tty/pty.c:391 > > So this is tty_port for o_tty. > > ... > >> BUG: memory leakx >> unreferenced object 0xffff88810e639800 (size 1024): >>   comm "syz-executor.5", pid 7522, jiffies 4294954305 (age 14.260s) >>   hex dump (first 32 bytes): >>     01 54 00 00 01 00 00 00 00 00 00 00 00 00 00 00  .T.............. >>     00 83 fa 19 82 88 ff ff a0 7f 9b 83 ff ff ff ff  ................ >>   backtrace: >>     [<000000003d61da44>] kmemleak_alloc_recursive >> include/linux/kmemleak.h:43 [inline] >>     [<000000003d61da44>] slab_post_alloc_hook mm/slab.h:522 [inline] >>     [<000000003d61da44>] slab_alloc mm/slab.c:3319 [inline] >>     [<000000003d61da44>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548 >>     [<000000001cfffc30>] kmalloc include/linux/slab.h:552 [inline] >>     [<000000001cfffc30>] kzalloc include/linux/slab.h:748 [inline] >>     [<000000001cfffc30>] alloc_tty_struct+0x3f/0x290 >> drivers/tty/tty_io.c:2981 >>     [<000000001946a70c>] pty_common_install+0xac/0x2b0 >> drivers/tty/pty.c:399 > > And this is o_tty proper. So we leak whole o_tty under some > circumstances... Trying to reproduce. And I failed. Looking into the code, I also can't find the scenario. One virtually possible could be hangup_work being cancelled while release_one_tty was scheduled on it. But I see this nowhere. A C reproducer would help. > BTW the reproducer says: > ioctl$TCSETS(r0, 0x40045431, ...) > > But 0x40045431 is TIOCSPTLCK, not TCSETS. > > thanks,-- js suse labs