Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1342860imm; Thu, 4 Oct 2018 12:01:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV60uG1sD96reTfrWv7RyUlKLDkheXAoFY6+zULoRVk+qmA6o/VE2RNAjXSQYiJJvwc4i1r3c X-Received: by 2002:a65:4cc3:: with SMTP id n3-v6mr7035233pgt.257.1538679696679; Thu, 04 Oct 2018 12:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538679696; cv=none; d=google.com; s=arc-20160816; b=TItrbzzRMoy3ncP6cnhhwiRqcFju72z+iCka7bWO2kiRVuPQNreldKoeQBMgUMoKk7 5LhYf7ta86y364Z2xyC2LeSAVFZDZB3Jz6onQf+NwVfnJn+5b5iJOFbUkSESzf5esY9b QlNOMtBdySlS9UnxtxSdtWr2blNhMrpnjO8Y9jkiYUGnjdZ8aokhzvF7zC2KAK1GQFUw wXQcP4YZmCvKzuZOkkJXQNZCO1PFPNyyTyzNP0277ESuW9tzn7Ynyl5uYUSljtv+HYvA s83FpIA469BHzDTRE/sFCZmwm/DGc0ghEFM069HKAuCctZy7+/e1qaaxlEvUJ/6W2hEN l5Og== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=ByrrTnNKG2Vk0e638TtaEFEqX7jB+JOThk7pu3SU1H8=; b=HhtmyDgPcF4kSlbeGiN8UX3X7gCrZVH/wVLAzAnwa38hb4wC7YqYirqDYPab1prRMi BtNDL5UVyHEaxEwjA4TvfmxCqkn4EV1ceEn7c90aa/xNp2BZWyyQFV/nJyIbJ+JeyuVz rnZzuEBPkBSM3F3loCyAGd6pPJb8ZOARJ95sI0EW8cniTVyzNBXrkK1qj4fglQmgGwUb MrrzI9LlH4JS4Q4CFmCj6znhxG+sAP7K/pdeynFWnUBBp7cgEAiVRo2zxVdVcJzmPfYg Fq7r4xJIaIG13USlUzODaUuHNWowK7shJQqSWZqiOcTwOt/Otzr5sSg3aNkGRCBOrdSY 8pvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTzW9MGK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j30-v6si4591930pgl.4.2018.10.04.12.01.21; Thu, 04 Oct 2018 12:01:36 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTzW9MGK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbeJEBy3 (ORCPT + 99 others); Thu, 4 Oct 2018 21:54:29 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34486 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbeJEBy2 (ORCPT ); Thu, 4 Oct 2018 21:54:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id g12-v6so3588192pgs.1; Thu, 04 Oct 2018 11:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ByrrTnNKG2Vk0e638TtaEFEqX7jB+JOThk7pu3SU1H8=; b=dTzW9MGKgZm7H0fZ6OdXQxb9DisUc8f4C+l1m6vFHJsnMBsBiCWmcbwDSag7msCjNI Jf8cIp2iotlP6+oFEqUy+ZvRNU513lcSxD5gCuzHk86Cef2i0XQa+RLBrWQUB/LsiXMW PDc2LGFyQyW+3wOho2rDkQQ+IfgxEYhVR2hxPVq11ri4hZE8ENy8qV4+t3BZAYANgyIn vJfDU3Lb42FABJrDdL5rffhcsGjzSnTVluN5U7Y/0kJSB9PO8aU9c4i3Ght/We4Vay1t G3Fy7pJCNH+FVnqjb0/xeBPj3JMHkBdePC6HJfVO3YdnAJsVCnrMuYYbHikD0iHZP/Zm 8UyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ByrrTnNKG2Vk0e638TtaEFEqX7jB+JOThk7pu3SU1H8=; b=D5Agx9lC0ZPHoYlOZKTX9fGZcPPuS0ynq+ARFM45crUBRhb1WmH2+kR/NHh0MImk8z fVCfEPlnhIfE48aEny6UysQnTbzkHuf/SFBFbVnqiewegzQ4jmh0OwoClDqZJOpGrhch 72FSzvcPkq6m89GOsnkw7APQT+sYptYZGkBVqv8TkJfb76i8aT/tvf3MfxjhDvwiZWKT 0gJbqsOZlO4eDkuHc0KSik7NOfRJUCSZsX5au6YDV+0gCwL0S89d+JmBzNv40mT2V1RC HFOr3IittiZDXrHk+k/ZAxlNo+OamDpNCpvUgQpe0hU1gjiYpRlZ2TdvwYZ13Y4m4mSo jx9g== X-Gm-Message-State: ABuFfoiTOf96sBZrTEvlekriTeKl/8wj8sgOtWxCs200hVdqBghpfdS6 fdOQlLxYndTY1FLc8CwAaZz1yEIpcDM= X-Received: by 2002:a62:c8c3:: with SMTP id i64-v6mr8280765pfk.183.1538679592998; Thu, 04 Oct 2018 11:59:52 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id p7-v6sm11007052pfb.101.2018.10.04.11.59.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 11:59:51 -0700 (PDT) Date: Thu, 4 Oct 2018 11:59:49 -0700 From: Dmitry Torokhov To: Eric Dumazet Cc: linux-kernel , Eric Dumazet , linux-input@vger.kernel.org, "Paul E. McKenney" Subject: Re: [PATCH] Input: mousedev - add a schedule point in mousedev_write() Message-ID: <20181004185949.GA233675@dtor-ws> References: <20181004154749.111595-1-edumazet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181004154749.111595-1-edumazet@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On Thu, Oct 04, 2018 at 08:47:49AM -0700, Eric Dumazet wrote: > syzbot was able to trigger rcu stalls by calling write() > with large number of bytes. > > Add a cond_resched() in the loop to avoid this. I think this simply masks a deeper issue. The code fetches characters from userspace in a loop, takes a lock, quickly places response in an output buffer, and releases interrupt. I do not see why this should cause stalls as we do not hold spinlock/interrupts off for extended period of time. Adding Paul so he can straighten me out... > > Link: https://lkml.org/lkml/2018/8/23/1106 > Signed-off-by: Eric Dumazet > Reported-by: syzbot+9436b02171ac0894d33e@syzkaller.appspotmail.com > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > --- > drivers/input/mousedev.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c > index e08228061bcdd2f97aaadece31d6c83eb7539ae5..412fa71245afe26a7a8ad75705566f83633ba347 100644 > --- a/drivers/input/mousedev.c > +++ b/drivers/input/mousedev.c > @@ -707,6 +707,7 @@ static ssize_t mousedev_write(struct file *file, const char __user *buffer, > mousedev_generate_response(client, c); > > spin_unlock_irq(&client->packet_lock); > + cond_resched(); > } > > kill_fasync(&client->fasync, SIGIO, POLL_IN); > -- > 2.19.0.605.g01d371f741-goog > Thanks. -- Dmitry