Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp946201pxu; Thu, 15 Oct 2020 22:50:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybM9VK7Vg2gP4PfYfQtGKfSwM7ngWvYn3iVVS0t6HWCl+XurQBC3ZSoqK7Zm+A9G+hn+Vd X-Received: by 2002:a17:906:5613:: with SMTP id f19mr1963089ejq.441.1602827430424; Thu, 15 Oct 2020 22:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602827430; cv=none; d=google.com; s=arc-20160816; b=q3f170VwJANK9WWQv7lmuPY5e+SwySIYGY07RSrfnWRa8mIdSrvJ3MO6uWusqfaOEG AqwomKm1+wLBmJSissodXOE6YwjIQXNhBZ34h2WsRAywVwudTY52FEmoVgMzq/r6Q0FB BruGHwrnHvO7pJikaiHND4PHwqxP3IkUEQXxbuJAPGJ3Fa5zpa8ds9G+rICVMVlApc1b zNSWiRYlcqM8nK/brCKYfXlBia0IB/amIGiPmjH1Gp2JzSp4RFilxzqAYWYi70TT3oq7 PocNLCTTkDRU9IXXYwy9rFKnp6GD9nHGRz8cpZPzwReHk9gnGgiOkinI6h/YZH+fGQvK M4UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=vGnGKcU4E7DFgr62TsRxPZJdQvwxqE7vmufXuceXSX0=; b=NnZnQLNrBAzlRueSKgg6nInMCKCfJiTJ4fvfkSKYeJQI78CmhWgXVm/1AGSNcKPzJB KuPe6HtHzqA1aanRa+mCeZyM64R49V7vtRXHqQYGKhzxhOjyKaNbaIsIBIgPoDd8H3xi eNYzyyu3VTFbdOXYbeYKcCFEXZQrD2YJXsZx9ApqaXLCmwEeS94DzR7glSrY+MdhC4ba ztHKIsE1+Z8BVL+eWQQhVes6Z+iA+zFoHrYrGVrt+fW3lzk/ZqqMdJfC/hyVg502VNee 3zLJWbMluR1kov5xuJjYoGdDL+FlTDuiBM+/ilH8O+ot99s74/6JqLXlVWi7Bk/iORKH 0a4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="KLn2/x9F"; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si1160216ejb.365.2020.10.15.22.50.08; Thu, 15 Oct 2020 22:50:30 -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=@ibm.com header.s=pp1 header.b="KLn2/x9F"; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390715AbgJPFoe (ORCPT + 99 others); Fri, 16 Oct 2020 01:44:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38328 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388836AbgJPFod (ORCPT ); Fri, 16 Oct 2020 01:44:33 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09G5VmKD118584; Fri, 16 Oct 2020 01:44:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type; s=pp1; bh=vGnGKcU4E7DFgr62TsRxPZJdQvwxqE7vmufXuceXSX0=; b=KLn2/x9Ff852xiZl05nmDBtYc6oPdBJVbIxF4wWngKpnIxpkgUfVODAXZASaA6iUUi+o trDEGusvS/nkTtuFUJRoz3yfQkzimZDEIzRVLwnK6Hdu4xuJmgA7FlwYhq24xKnuyvvT M9dWTWzm1wTbRwY3pAInaY37rGhV5l4xmnA5ksrOO+ltvpgNUguQ9q2VU2ndd0YnzFTf gpOXtB84YwvxkxfvHx7qCx/5ReuyPQnsqMg+tYOyobx9/bwY5E7XxK5VtXx3uTeFcOt+ vuGeZXOkQbd9ZZia1WztoEN+hIAuXFzV2qR5aZLwlePDxm0Jg9PzKr0F7vHdGmqvZtie EA== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 3475038x0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Oct 2020 01:44:19 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09G5fxJW002683; Fri, 16 Oct 2020 05:44:17 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 3434k7wx26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Oct 2020 05:44:17 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09G5iFgm33489184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Oct 2020 05:44:15 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9479FA405B; Fri, 16 Oct 2020 05:44:15 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47A53A405C; Fri, 16 Oct 2020 05:44:15 +0000 (GMT) Received: from tuxmaker.linux.ibm.com (unknown [9.152.85.9]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 16 Oct 2020 05:44:15 +0000 (GMT) From: Sven Schnelle To: Kees Cook Cc: Krzysztof Kozlowski , Christian Borntraeger , Linus Torvalds , Christoph Hellwig , linux-kernel@vger.kernel.org, Linux-Next Mailing List , "viro@zeniv.linux.org.uk" Subject: Re: autofs crash with latest linux-next References: <8a4c7324-4637-7f25-82b6-2fd30aacb73e@de.ibm.com> <20201014071547.GA2459@kozik-lap> <202010151226.7382E03@keescook> Date: Fri, 16 Oct 2020 07:44:14 +0200 In-Reply-To: <202010151226.7382E03@keescook> (Kees Cook's message of "Thu, 15 Oct 2020 12:28:14 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-10-16_01:2020-10-16,2020-10-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 clxscore=1031 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010160034 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook writes: > 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. Thanks, missed that. Sven