Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp997045imm; Tue, 5 Jun 2018 07:39:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLwALxXoisjwwrRkWY7/r0CSMjcnq7A9Q7ezYQAfUCMq0fcp7X7H6kyx99ujm2dYqzYGgW/ X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr26681914plg.206.1528209589170; Tue, 05 Jun 2018 07:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528209589; cv=none; d=google.com; s=arc-20160816; b=N5gbNS1GsAsn41e52LqO7lXlgRVUE/DRz7IVCuQU5owvJp7LdAVruETTjRAtp4hbx4 9QvJAuIthR7D37XLBDtrBjD5JNHnqL04XTICEVoDCDczdVM68ulH5exwvUwajTybSDeb WAk7X9VZWUWdzx4UqnplJ8yTI+2UN4aUR3XcbIt5ugBg7WtGOYbD/kss44dPuhpvdhgU a6AWS22H1jHHROxwZX891/+hhzeRJEzvhgCXMYst+bfFCwhSDX2u5BjPLzRqV9RCgQYJ U0tRSi+BztPg2rAKFfaK32/G5gxHJe8DJx+BHgC6hJ1O7Sc4olCdGuXfhJXLzqbnOAho jE5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=iNGCObuDfylhRtT23wwDsh8aCi/2PnrpM/d5IPkEyWg=; b=GeXB6aarNu42KPBXw3A31ah0MyJPjUiEsvDdmG+0M11LvosfBbDCcOehRLzEYMijVm yWZk+Fhmi33toQeW7xVUxlNCVyNx+yEAENzE0XJOoxF8bKo3IMnhoH7OF8KDAvoGdSnR Bj9Ce+QU8mpIv0RBXuWmKdEw/vB3PO/RxaW8a4E+CYf3JZDvprHuTvQ7OSSPTdBD3O0T Y1tiwz/2AI7zWWL1l2E4Zc4csGdjl86LOYZf+2KO7ZDU0xyFHk2+71E27TUIhn62YcnA i9F4lzuhBvAEj9gDYKHZF49QAQ1zZpkvjQ2GDeAFLxH5lN2gxlGCXMvwjpYbufwQspTO y5Rg== 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 s17-v6si10336655pgv.639.2018.06.05.07.39.34; Tue, 05 Jun 2018 07:39:49 -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 S1752445AbeFEOhz (ORCPT + 99 others); Tue, 5 Jun 2018 10:37:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:51865 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbeFEOhy (ORCPT ); Tue, 5 Jun 2018 10:37:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BBC49AF25; Tue, 5 Jun 2018 14:37:52 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 5AB46DA992; Tue, 5 Jun 2018 16:35:07 +0200 (CEST) Date: Tue, 5 Jun 2018 16:35:07 +0200 From: David Sterba To: Jens Axboe Cc: Kent Overstreet , torvalds@linux-foundation.org, snitzer@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dm: Use kzalloc for all structs with embedded biosets/mempools Message-ID: <20180605143507.2o3qm4r6euvyhe5g@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Jens Axboe , Kent Overstreet , torvalds@linux-foundation.org, snitzer@redhat.com, linux-kernel@vger.kernel.org References: <20180605092633.29583-1-kent.overstreet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 05, 2018 at 08:22:22AM -0600, Jens Axboe wrote: > > I fucked up majorly on the bioset/mempool conversion - I forgot to check that > > everything biosets/mempools were being embedded in was actually being zeroed on > > allocation. Device mapper currently explodes, you'll probably want to apply this > > patch post haste. > > > > I have now done that auditing, for every single conversion - this patch fixes > > everything I found. There do not seem to be any incorrect ones outside of device > > mapper... > > > > We'll probably want a second patch that either a) changes > > bioset_init()/mempool_init() to zero the passed in bioset/mempool first, or b) > > my preference, WARN() or BUG() if they're passed memory that isn't zeroed. > > Odd, haven't seen a crash, but probably requires kasan or poisoning to > trigger anything? Mike's tree also had the changes, since they were based > on the block tree. eg. fstests/generic/081 crashes (trace below), no KASAN, PAGE_POISONING=y, PAGE_POISONING_NO_SANITY=y. > I can queue this up and ship it later today. Mike, you want to review > this one? Would be great to push that soon. The fstests build on several DM targets, the crashes lead to many test failures. I'm going to test the kzalloc fix now. [ 8546.936276] BUG: unable to handle kernel paging request at ffff8a3314cabf98 [ 8546.943407] PGD 1e4915067 P4D 1e4915067 PUD 0 [ 8546.948006] Oops: 0000 [#1] PREEMPT SMP [ 8546.951984] CPU: 5 PID: 11452 Comm: lvm Not tainted 4.17.0-1.ge195904-vanilla+ #249 [ 8546.959849] Hardware name: empty empty/S3993, BIOS PAQEX0-3 02/24/2008 [ 8546.966532] RIP: 0010:remove_element.isra.8+0x2e/0x200 [ 8546.991185] RSP: 0018:ffff9af9c1bf3ba8 EFLAGS: 00010206 [ 8546.996553] RAX: 000000006b6b6b6a RBX: ffff8a2fb95d8008 RCX: 0000000000000000 [ 8547.003831] RDX: 000000006b6b6b6b RSI: 0000000000000000 RDI: ffff8a2fb95d8008 [ 8547.011107] RBP: 000000006b6b6b6a R08: 0000000000000000 R09: 0000000000000001 [ 8547.018378] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8a2fb96f6448 [ 8547.025668] R13: ffff8a2fb0ee6d58 R14: ffffffffc05d2a00 R15: ffff9af9c1bf3d08 [ 8547.032956] FS: 00007fe863936880(0000) GS:ffff8a2fe7000000(0000) knlGS:0000000000000000 [ 8547.041269] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8547.047167] CR2: ffff8a3314cabf98 CR3: 00000001fee98000 CR4: 00000000000006e0 [ 8547.054457] Call Trace: [ 8547.057078] ? dev_wait+0xa0/0xa0 [dm_mod] [ 8547.061323] mempool_exit+0x18/0x50 [ 8547.064974] dm_io_client_destroy+0xe/0x30 [dm_mod] [ 8547.070028] dm_kcopyd_client_destroy+0x86/0x130 [dm_mod] [ 8547.075614] ? dev_wait+0xa0/0xa0 [dm_mod] [ 8547.079875] snapshot_dtr+0xb3/0x170 [dm_snapshot] [ 8547.084844] dm_table_destroy+0x62/0x140 [dm_mod] [ 8547.089720] ? dev_wait+0xa0/0xa0 [dm_mod] [ 8547.094000] dev_suspend+0xe6/0x270 [dm_mod] [ 8547.098448] ctl_ioctl+0x220/0x540 [dm_mod] [ 8547.102845] dm_ctl_ioctl+0xa/0x10 [dm_mod] [ 8547.107196] do_vfs_ioctl+0x91/0x6c0 [ 8547.110923] ? kfree+0x1e5/0x310 [ 8547.114313] ? syscall_trace_enter+0x1ce/0x3c0 [ 8547.118915] ksys_ioctl+0x70/0x80 [ 8547.122388] ? trace_hardirqs_off_thunk+0x1a/0x1c [ 8547.127247] __x64_sys_ioctl+0x16/0x20 [ 8547.131140] do_syscall_64+0x62/0x1c0 [ 8547.134968] entry_SYSCALL_64_after_hwframe+0x49/0xbe