Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4985538rdb; Sat, 30 Dec 2023 00:35:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUzbqWcs+9ElmT3dwu541j1E4YHPvkDXfQOM/BfP7ZMSSG3qe4YqM1hjDBzt0auKc+5wX8 X-Received: by 2002:a05:6870:328c:b0:204:2c5e:1a77 with SMTP id q12-20020a056870328c00b002042c5e1a77mr14865827oac.49.1703925308107; Sat, 30 Dec 2023 00:35:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703925308; cv=none; d=google.com; s=arc-20160816; b=PhOg6/vUaAiWX1Nt4vz6rc/tmQMofzd9sBEuocJJvdfN1zXFSz5psvK2c/06tJJ0KL 6FqBxDMCXelDr0Aten5mOHSA9RYLD/WaMS91K+FNWL5MPNrLwAECRKSIU7GnQQb6alSC Avyt9RG8pvYbLKgw86rOQeTestx6ZqQBYD3Bo203H8Q3rlfPP4EydqW7asL2f9y8uQzD tsO62Kv0QUfcPwKtnYfrThWVqDzzEGuyBiWFSF4wLiobIZN5g+PP8PKOYkL3awbgLN1r ZU2zSEHLSTYLfdnTll6Qkx0bVhu2++YYMRx+8FsBGAql0jUxzcfVDEJLqZNTdoLgb3y/ xAPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=jKSwzg5qyL9S9punEuxfKNhmr3B9w+Hx8x84ychqNZo=; fh=B9v7qeW+IoG2WnAcLK2GodcYoHl2Wsu7H855JL20/HY=; b=oH1lqC/kiteRudA7PKeYG5UkpYEH0H9efOecIvInXpWcIZgPsqB/Y0QGG4OYV5c6ib IY8u8LXHkkFDPCgsEVHHumhXh3QT7s+fru7O5HW1kfe0jbOb/g4gz+lMbFZ5bn/hFDgo UQYHRA/G93tSVFX8fp0BayjE6sHtaeFfTQUw/dfqsy52ExGxdB9QTTdf2g6sZtj59sCX aaFfgQ9I+JP5qIXprxtves2OT6WgiILDW2WTz6hblg6FQQnTvXNWHic4HNadAhra9LiH yWddEmzv+M9rUN+6QXDmuklUHugcby3CwFLY0oZ19+9E8FmkC1eP2uhh5mO42SNjUjcx i3WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quora.org header.s=google header.b="I4KSlf/e"; spf=pass (google.com: domain of linux-kernel+bounces-13364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13364-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h7-20020a654047000000b005cdba90861bsi6369977pgp.39.2023.12.30.00.35.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 00:35:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quora.org header.s=google header.b="I4KSlf/e"; spf=pass (google.com: domain of linux-kernel+bounces-13364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13364-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3B073B2136D for ; Sat, 30 Dec 2023 08:35:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD36F2584; Sat, 30 Dec 2023 08:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=quora.org header.i=@quora.org header.b="I4KSlf/e" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A11BB23AF for ; Sat, 30 Dec 2023 08:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=quora.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quora.org Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a2768b78a9eso337311366b.0 for ; Sat, 30 Dec 2023 00:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quora.org; s=google; t=1703925291; x=1704530091; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jKSwzg5qyL9S9punEuxfKNhmr3B9w+Hx8x84ychqNZo=; b=I4KSlf/eOLGBilBW0ohqJzKGmtzMjF8aOokU1I67Uaj+/q+7O1XvwDkB+hYTJCN6/U 8q8g79Yf7SlbB0gnUafJC+RCqpwHSNa9bU1gVMoi3bgbs34VPnzSR+MAq322FzohJtim 83/D5r5jCLppj6nSv4vAQKe6P2m/NHmg6ChV4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703925291; x=1704530091; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jKSwzg5qyL9S9punEuxfKNhmr3B9w+Hx8x84ychqNZo=; b=ldzlg4UOPHxr1aWxntEmLM466/Ot43K69gg+53tuAjGPOFrt3182GgXE4pMtti6xC1 W6xKCqVjfyYLbpaUb1Kkvosej7Hkxuyaf7WTETKxjBO4SaqDqEWYhkpODy4AuItn+6ke 7cdP8arMZrbAA6qhnPKlG/WWjsEXg8I6xKf0kaGrkUVYHu7F9PjhqfydXdew+qwyHqkc UpqoJuFWktaLYJoneXggK2YuiZvyioNsZSxhMGHgiB2rbiYnnj5AFIlTwmqUsG8aRms0 l4W/uDtlLbT8fvZYOI2fleklm7zas3CbvssRjHjgy+9Agt8pP1DOD7COHEujEYHSYbLM Bs0g== X-Gm-Message-State: AOJu0YwlNyNlJ3weivi850DhRh/qaWefEwchb8N0EF+1LTZLGOkN5UKg nq/MWWFYNJ+X//CGZlERqVJ7ZIphWt0XJ8zCAU6LnOgEa3iglQ== X-Received: by 2002:a17:906:97:b0:a27:a953:bf63 with SMTP id 23-20020a170906009700b00a27a953bf63mr1356526ejc.42.1703925291104; Sat, 30 Dec 2023 00:34:51 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Daniel J Blueman Date: Sat, 30 Dec 2023 16:34:39 +0800 Message-ID: Subject: Re: Stack corruption in bch2_nocow_write To: Kent Overstreet Cc: linux-bcachefs@vger.kernel.org, Linux Kernel Content-Type: text/plain; charset="UTF-8" On Sat, 30 Dec 2023 at 02:54, Kent Overstreet wrote: > > On Fri, Dec 29, 2023 at 07:43:13PM +0800, Daniel J Blueman wrote: > > Hi Kent et al, > > > > On Linux 6.7-rc7 from bcachefs master SHA f3608cbdfd built with UBSAN > > [1], with a crafted workload [2] I'm able to trigger stack corruption > > in bch2_nocow_write [3]. > > > > Let me know if you can't reproduce it and I'll check reproducibility > > on another platform, and let me know for any patch testing. > > this should be fixed in the testing branch: > > commit ab35f724070ccdaa31f6376a1890473e7d031ed0 > Author: Kent Overstreet > Date: Fri Dec 29 13:54:00 2023 -0500 > > bcachefs: fix nocow write path when writing to multiple extents > > Signed-off-by: Kent Overstreet > > diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c > index c5961bac19f0..7c5963cd0b85 100644 > --- a/fs/bcachefs/io_write.c > +++ b/fs/bcachefs/io_write.c > @@ -1316,6 +1316,7 @@ static void bch2_nocow_write(struct bch_write_op *op) > closure_get(&op->cl); > bch2_submit_wbio_replicas(to_wbio(bio), c, BCH_DATA_user, > op->insert_keys.top, true); > + nr_buckets = 0; > > bch2_keylist_push(&op->insert_keys); > if (op->flags & BCH_WRITE_DONE) Thanks for the quick update, Kent. With this change and a few runs of the reproducer, I still hit this stack corruption with the same backtrace. Let me know for any further testing, Dan -- Daniel J Blueman