Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp733689pxu; Thu, 15 Oct 2020 15:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy02Gy9BjtB4yfzSmJC234A3hPTMQcorGevkQFFexFQ4FwNWxkZobTa5MHZ1lAEdfePGLVO X-Received: by 2002:aa7:c358:: with SMTP id j24mr644386edr.265.1602800552605; Thu, 15 Oct 2020 15:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602800552; cv=none; d=google.com; s=arc-20160816; b=bymwdbrZ8Ciina/fuMJZ39wNZO39vAtInqbllOeTQE274z9oR0o7miJA7sKWLUy65M WMoMVVUyJ77tiK0PWmgYIL3SOXDXHAFjAVXPKHAhgP4bx7wlJDxwl3xlBFoBVAbkTyC7 0G26PY7jb2XYSejHxiufX04X7HWuIrLsFdTbxnxCkvzNSJZ/B5pmMj8CQtDjUz2o/l4P 0K62A0LfPFKiZtsGsX6xMoTL9umKSPoEpvrYuiux1gU8Lm9BZpR/oWCjSxP4ELVNbJqU DE1n9r2u924I0kyRXIRhqwvXJhL2dFRpdzemE6OE+jzFWKnRLMZMOV5S7zvlRr95Csq3 pJqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DCV3REzZqEIWqI9vlCZaGhY7dlN/0fH9nQqcan6hRmw=; b=w/i4aXB60/7dh+rzN0+yhH+prZ2RANxhfiZzAZ/7iMWpUwR+6YhVBQewV528wSBGYe jy537lMXvgEC1z72KO1vlCnSzA9UfWaRuhou442XKhWFksBPUv0NLkuHmEZYbVWV5RZC nGeYeopmOuQUL2qvIW0R7SNV5ZGuDVmoqPtFLgawUSd4BBnjI7ilmbky+dR432gWjZ6J 7N2nDCkaTRc94vnkXwJReE/fwuWGGfQsHjq0NW33TWGPa0xXqP380NPyQTYoNtt/0ytf iScaVKYkorHdHMOYfVrKfyt4l1lvt3cUeQ+60MPOdhN4DWgXOmB203LJTHvkG9z+CqDV yJyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XYfnpBcp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si215845edw.608.2020.10.15.15.22.10; Thu, 15 Oct 2020 15:22:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=XYfnpBcp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392034AbgJOT6w (ORCPT + 99 others); Thu, 15 Oct 2020 15:58:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:35614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392022AbgJOT6w (ORCPT ); Thu, 15 Oct 2020 15:58:52 -0400 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39D46206DD; Thu, 15 Oct 2020 19:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602791931; bh=2GblqwhkPAkE0TtieY26EFCAPXf3227FX1JmTZGYNnI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XYfnpBcpyXx7zbOdzpxmxARFYf6LEuMwNeQhFznzqXISUOClvAW+YS298L/pb9Vl0 Wsr9chYIILNU2NVUFCf01DIBICAzSdUSzSEhMEnBNgc0858QOpnnW01lkjK0xEOjeo DyKNNoWQZfJ8YOXUpu7cxa6AMbp7JTy5QKB6rXaA= Received: by mail-ej1-f48.google.com with SMTP id p5so5409463ejj.2; Thu, 15 Oct 2020 12:58:51 -0700 (PDT) X-Gm-Message-State: AOAM532V02dL9KTpgEixMPG8VvkwT+gQImBmz9atAaW650zKc/wCgqyl 4L38i9jI/juisJaDdGOewxeCVD6m9Okb2dra8Yg= X-Received: by 2002:a17:906:6a07:: with SMTP id o7mr6275959ejr.454.1602791929686; Thu, 15 Oct 2020 12:58:49 -0700 (PDT) MIME-Version: 1.0 References: <8a4c7324-4637-7f25-82b6-2fd30aacb73e@de.ibm.com> <20201014071547.GA2459@kozik-lap> <202010151226.7382E03@keescook> In-Reply-To: <202010151226.7382E03@keescook> From: Krzysztof Kozlowski Date: Thu, 15 Oct 2020 21:58:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: autofs crash with latest linux-next To: Kees Cook Cc: Christian Borntraeger , Sven Schnelle , Linus Torvalds , Christoph Hellwig , "linux-kernel@vger.kernel.org" , Linux-Next Mailing List , "viro@zeniv.linux.org.uk" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Oct 2020 at 21:28, Kees Cook wrote: > > On Wed, Oct 14, 2020 at 09:15:47AM +0200, Krzysztof Kozlowski wrote: > > I hit this since few days as well. Although the bisect points to the > > merge, the issue looks like a result of mentioned commit 4d03e3cc5982 > > ("fs: don't allow kernel reads and writes without iter ops"). > > > > The __kernel_read() last argument 'pos' can be NULL and it is > > dereferenced here (added by the commit): > > > > 525 ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos) > > ... > > 547 kiocb.ki_pos = *pos; > > 548 iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); > > > > > > The __kernel_read() is called with NULL in fs/autofs/waitq.c: > > > > 45 static int autofs_write(struct autofs_sb_info *sbi, > > 46 struct file *file, const void *addr, int bytes) > > > > ... > > 54 mutex_lock(&sbi->pipe_mutex); > > 55 while (bytes) { > > 56 wr = __kernel_write(file, data, bytes, NULL); > > I think the thread here is the same thing, but you've found it in > autofs... > https://lore.kernel.org/lkml/CAHk-=wgj=mKeN-EfV5tKwJNeHPLG0dybq+R5ZyGuc4WeUnqcmA@mail.gmail.com/ Indeed it looks the same. Thanks for the pointer. Best regards, Krzysztof