Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3331316lqo; Tue, 21 May 2024 13:47:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPnpkfnQtMtrtIVVnTlPIQFQPyPebQUPoNIFvG+RZakTN773jGYX0ZEjhWkR9aRoleNsAKIoa1veO9/OsXV2Pf3sv0SekRx3qW1Lh6uA== X-Google-Smtp-Source: AGHT+IH/FsJUauAPhh7NxQ2CnPZ/yD1iiY07S6qG2DVg2XlxWb6QRh0x+a6f2+Ys+LFJuS3Sz1Wx X-Received: by 2002:a05:620a:400b:b0:792:ff71:3f26 with SMTP id af79cd13be357-79499455ee1mr8232885a.35.1716324426212; Tue, 21 May 2024 13:47:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716324426; cv=pass; d=google.com; s=arc-20160816; b=maGkr7SGCXZaszonn4u3ZagthLfYyHu9XAaopf/0tceT3D9z0veDQ4gaKP+GTgKS8K L44z7R12YU2ousyXtP+Np7qTdGTysbn1UUnLFliRIBEFd1myNbZvT5fXylGAqs8o5ghS cagXsd92Yh911sxUyYmxAxxM72Rb9oqpzY/NgYvjjmkpdIGg7Hyys/ZSVGwwNofcYOyH xrCkt7HtwyTfqE0m0FwNgk7CjAqxvLTRYJIPdAxk0HZP3QBuPGdGNufWfQEIlQxo06e4 qmuBwsBq9HmCwlLO9Fa75QkexdhiChl6UCUKnMFFMmWU6LPPTosyV2HBdFg4V2qa66f6 Zg1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RwCS/BKSDM1f7z64QrAXpA4rfh3F6s6yn7di6QgXgHU=; fh=E0ZZ09y+GPQeSZ+yAJrOQXbN0HcEcTizbbe270dQMM0=; b=nqm8SrwLHF8ZD2tNDohqaYjIMQGLSb9WOfihZu2B+NFHlNkzpnjtYtfgXamWHQ9mbW MwWBQbrIq69J3tFKYEmdhJw2tSqRjjvQGsFlOYk7wFaZTEfe3vvHEz5BeIqlGG6HOb9k g7/yc+chqSaN+sKVbzgkDcPd6HsmhEQisYFJTWZ8RLw6IyKTVuQ7+JHuakRW8vNEpViZ j/8h3yy/OEorwyVZxHD2wqyOyUX7epp8tHiEcj8FefZphqMiVpm6DIDOq8H7ar2dMM6h Vp2V/pr7dQD6PW3xLX2yW+x6CvoINdHKyo19ZhJGFULzGQXGxgpk0N+gkJUHIIlDNGJl mvxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AzYYGIFO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e25df7805si23063671cf.199.2024.05.21.13.47.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AzYYGIFO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D96E51C219EB for ; Tue, 21 May 2024 20:47:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A7071494D8; Tue, 21 May 2024 20:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AzYYGIFO" Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 90A1DD51E; Tue, 21 May 2024 20:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324415; cv=none; b=rRIM+ONINqvkN/QNVQSK39nldnYfxvc152Oa3ksupPghLEbgzxMwPAlmoAJ0xzjVrBHiGohVv5RoGLOThyhSa+HvppeJbVT/M3IxrhoHnGmFaziw7U0gRCK3uMqBSkDUtjonsHSzjjwi1x8qoHVkAuNQdOM67tw2YwzhTbpbrHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324415; c=relaxed/simple; bh=RwCS/BKSDM1f7z64QrAXpA4rfh3F6s6yn7di6QgXgHU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LoywmstoGkXFNky7ttAGyJnoHlV7sWDhVnsw0uujOfEu+5f+RCCLX+Ih+2Q/s4F57bS2DUEZKdSyER9Ch6ye/y9PuUn5eHqGTGEqqdRvod35T2MinO1a7ZPQc1BTLGszpLXyl/HWAQzhz8Rbnpp3XI0bxJKZ9Pw8KULfLconxts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AzYYGIFO; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4200ee78f35so26401285e9.1; Tue, 21 May 2024 13:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716324412; x=1716929212; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RwCS/BKSDM1f7z64QrAXpA4rfh3F6s6yn7di6QgXgHU=; b=AzYYGIFOfIYAdWflhdP3WFQQvZ6kfM1c+3bnsZWrq4ctQ58568thTSjjhyErKGFlYq U+W0N9Wg456aeUUJtiOZGGQdnC3ip7xnpiBHkm0kFuJPSf9U0ex/w9qEULKpTUle1IOI 47xc3FIlhCkWxdCdJSe3WEJqiCf5DkTPkqN09Mz7U/dXPtJy9BA1qlcGRmkJbaoZdcvT svoZvmw+TCa2U0lXxSk9M2RmVR4hijnn3e5+BHEDHA1Y1JRGipUtQS0zKboqFUMD45Rn zRO0rP5e0ydoxuj6eYmejr/QeyxhHmRrDw6ZPNdJYfDbhwzVo3C/Wyp/E1auBx+bezwN cwQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716324412; x=1716929212; h=content-transfer-encoding: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=RwCS/BKSDM1f7z64QrAXpA4rfh3F6s6yn7di6QgXgHU=; b=D1cnBOorONL0sYJbE7/hD/B6qVoc0vCSG+QGIVRCensIvU8Lb4zGli5fJQNOSAcUAf K1UAkJ4uIwJUisRntLv/84XEp6mWLVxZEll1fHNj1rhu8NsQFM8O/6XJ7ayqpT+a1d0M qiO489QzEZ3gd8g8DVn3l7Brl1/35dqZIFN24Y2Gt7MNF4Ri+OwCT+iYYnWwe7aDckMD OwNpNfJLQfM013FwvNfdakL2iekLukfQqAodiigp4kgg4nMumZDfDmRbhM1cCdhL4aVE /YYSZ8T+mrQAayqpX+j0pyo4rtV4uLPAdJO8UyXki3guDRFu8qPZ5YI6XrtrZ/Asilf5 5/dA== X-Forwarded-Encrypted: i=1; AJvYcCUNrivzw2bCR/W+xI+vK021QcnIlBdOhJ/9EJpgCW5JyEZBXAlXe1Exru8STedSGh+2BJ7YKLcdSA/RFlpus6QTVqJb4qKuMst79H9Gt1Q1549UjMz0XnY1U+b6eeG4GjGtMwbwF9Pe X-Gm-Message-State: AOJu0Yz/qCZJuvQELUmMkTflmyo7NBRIPxRZLWtLpV51Zm/JQ3bTfTPq NyZzeIAOkHVHw2STc1tFAOCLlw5jA11iM6yjJLKUegkd6rhyehtMAZpiwMIvbYKl8TlViMRPIOX 6luJGd+MAfid4wtg6zIXaVfBmu8Q= X-Received: by 2002:a7b:c30b:0:b0:41f:bcd7:303f with SMTP id 5b1f17b1804b1-420fd30e480mr156395e9.16.1716324411817; Tue, 21 May 2024 13:46:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240520205856.162910-1-andrey.konovalov@linux.dev> In-Reply-To: From: Andrey Konovalov Date: Tue, 21 May 2024 22:46:40 +0200 Message-ID: Subject: Re: [PATCH] kcov, usb: disable interrupts in kcov_remote_start_usb_softirq To: Dmitry Vyukov Cc: andrey.konovalov@linux.dev, Alan Stern , Greg Kroah-Hartman , Marco Elver , Alexander Potapenko , kasan-dev@googlegroups.com, Tetsuo Handa , Tejun Heo , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 21, 2024 at 6:35=E2=80=AFAM Dmitry Vyukov = wrote: > > On Mon, 20 May 2024 at 22:59, wrote: > > > > From: Andrey Konovalov > > > > After commit 8fea0c8fda30 ("usb: core: hcd: Convert from tasklet to BH > > workqueue"), usb_giveback_urb_bh() runs in the BH workqueue with > > interrupts enabled. > > > > Thus, the remote coverage collection section in usb_giveback_urb_bh()-> > > __usb_hcd_giveback_urb() might be interrupted, and the interrupt handle= r > > might invoke __usb_hcd_giveback_urb() again. > > > > This breaks KCOV, as it does not support nested remote coverage collect= ion > > sections within the same context (neither in task nor in softirq). > > > > Update kcov_remote_start/stop_usb_softirq() to disable interrupts for t= he > > duration of the coverage collection section to avoid nested sections in > > the softirq context (in addition to such in the task context, which are > > already handled). > > Besides the issue pointed by the test robot: > > Acked-by: Dmitry Vyukov > > Thanks for fixing this. Thanks for the ack! > This section of code does not rely on reentrancy, right? E.g. one > callback won't wait for completion of another callback? I think all should be good. Before the BH workqueue change, the code ran with interrupts disabled. > At some point we started seeing lots of "remote cover enable write > trace failed (errno 17)" errors while running syzkaller. Can these > errors be caused by this issue? This looks like a different issue. I also noticed this when I tried running a log with a bunch of USB programs via syz-execprog. Not sure why this happens, but I still see it with this patch applied. Thanks!