Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3040747pxt; Mon, 9 Aug 2021 15:29:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVe01GcKRC9iDg0yjxmYT/7fPHvTVlGyhIege/pBJ9NSILQfQnBUuC1fcdKSJkCCf/NjKN X-Received: by 2002:a17:906:a18b:: with SMTP id s11mr25227843ejy.8.1628548156001; Mon, 09 Aug 2021 15:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628548155; cv=none; d=google.com; s=arc-20160816; b=ZKEO+Irau8KkIAc/otBfb2zn43c7vFG4RUlqYvHQTfy4cKNd0qeAUqsUGiLqKjKRBf m8rx0uwoJrni4R8SOM37ogxjYGHhU7ZucI0NJIoH1M726n6acEyXMaO2ZP6t/Q/1yxGH MzbpjBqTGjfeNYUiAkydLr1PVwYA9hNH17BpD0kfRgla2cudSwDSoztXRH0DeB7b2BFe gMjD6IhaHRyGhBNdlNdmPeGoEr36X7h4NEEKzlKdI4ANp5VG7D1hVTeqXQhL6G7MUm3f eEcSJWlDNndjrU1ztzB0vYkOt8F27MDtACTTLtt3O4xSN2xOPh+Jf0diIUy1tpC9pfGe K9sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1ccaM+Yin/j3rEvNUkkpbsGYJSogO9rgnt7sNZIdg1o=; b=YPYx82yk+Y9I4ULajvgeFOu61U0aQjmGJpEFeUxUADh/P1U2gupP5gWUf+WERDCBvE YdSD6EqdRmE1uw/POi9be88PgZzZjjs/tI5mRF/+QjJKsysaCbllNPtq2HTM4JHuMTqt tNnyfFXDdbsACcpK1+fuDuxWNQPMJQJ3bt/nXkYddW2m1kYgyprtxBR6e8h9yLp7/AnO xvyEfSWf/IHcj0AHzn5+hQTaqQHFHDVzTnkvCQ6PsIHY6k6FBoLnT38RYNAtIrxm6Ap0 liliCYGoqICm+KuQQL5q5YFM8JpZNkDtOOvUe9ByPBCsG1aLEyMe6JSnLOk640pKYzEI UsyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si7057487ejk.259.2021.08.09.15.28.50; Mon, 09 Aug 2021 15:29:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233565AbhHIUFK (ORCPT + 99 others); Mon, 9 Aug 2021 16:05:10 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:58844 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233617AbhHIUFI (ORCPT ); Mon, 9 Aug 2021 16:05:08 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBVo-009Lfx-Ey; Mon, 09 Aug 2021 20:04:40 +0000 Date: Mon, 9 Aug 2021 20:04:40 +0000 From: Al Viro To: Shoaib Rao Cc: Dmitry Vyukov , syzbot , andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, christian.brauner@ubuntu.com, cong.wang@bytedance.com, daniel@iogearbox.net, davem@davemloft.net, edumazet@google.com, jamorris@linux.microsoft.com, john.fastabend@gmail.com, kafai@fb.com, kpsingh@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, shuah@kernel.org, songliubraving@fb.com, syzkaller-bugs@googlegroups.com, yhs@fb.com Subject: Re: [syzbot] BUG: sleeping function called from invalid context in _copy_to_iter Message-ID: References: <0000000000006bd0b305c914c3dc@google.com> <0c106e6c-672f-474e-5815-97b65596139d@oracle.com> <2901262f-1ba7-74c0-e5fc-394b65414d12@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2901262f-1ba7-74c0-e5fc-394b65414d12@oracle.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 09, 2021 at 12:40:03PM -0700, Shoaib Rao wrote: > Page faults occur all the time, the page may not even be in the cache or the > mapping is not there (mmap), so I would not consider this a bug. The code > should complain about all other calls as they are also copying? to user > pages. I must not be following some semantics for the code to be triggered > but I can not figure that out. What is the recommended interface to do user > copy from kernel? What are you talking about? Yes, page faults happen. No, they must not be triggered in contexts when you cannot afford going to sleep. In particular, you can't do that while holding a spinlock. There are things that can't be done under a spinlock. If your commit is attempting that, it's simply broken.