Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3932022imm; Mon, 8 Oct 2018 11:54:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV607ok6WMoO3BXUITUtjkj5XweOus8pGtlEbnnaMS4Bdd7Bw0owP+5ytJ8NWpAl30sJxEu65 X-Received: by 2002:a63:4904:: with SMTP id w4-v6mr938621pga.303.1539024862067; Mon, 08 Oct 2018 11:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024862; cv=none; d=google.com; s=arc-20160816; b=IR5+X1+aFGdwGAgXl886VtIsCXRrEdvfB3Yxa+NMZ17DDo/MOoBihBecKA7+IQiGND uhLkDxeG8F6KfI7soxY33DkXz9uE8LTSWfHKDC6A44yrrJkEWfVqMZinC0b4Pth3ffvd 5kVslCy7A22ion8DiBBS4AeMu42mrK32TlCWj8YOaSNq2EKY3vMXumXzap3ehkfLooSs xBiKSgAhkuW1NE8RQcHCNnzcMdDbGS1p8OQs9ZRysimmAtJUQqOteo0DNTEs/yJdj9Dc WKvDiAVO1k5MU2/60BLrTt3vgQ+CBZwZrQTQnhQHTXr9pRZBWyy59yAjUMy6AOp7bRTL fHzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xUtyLcGj0+KeasTl8ao32C/jKnH/lVC1jYRMDK+8Fkw=; b=p5qhfR7D9M7mXDf5xF3dxSXMgqr/EKpRcn/K5uQR5aJmUPbFS7n4AwIVtt1IPwyyrZ bSC6j4sG+KscQK+zEqf1xsUkZbKUunijQTBv+/AES6KIo8A1TVvqAe2v1tCuTLUSHmET omk7aZcMWqPO0JRHwuMXX7hJ775Ll/mkTJuuWD/BreQgsfw0X0W9NmiQcNnGeM1mx1mH daicao+HUAha7qaCUc/zCHxVkH2Lqex08/V3WWIfMlZ11jfbNdMbDOoztYiUBoNfxhBU CMw7H65zzJw6kJiGg8uL8WvW2R4Rb8SXevM3hXGMgQyrZPjDbKuNTKB4p3JPj/OKaXvs sLOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q3dD7Fs4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a127-v6si11356933pfb.24.2018.10.08.11.54.07; Mon, 08 Oct 2018 11:54:22 -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=@kernel.org header.s=default header.b=q3dD7Fs4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732621AbeJICF5 (ORCPT + 99 others); Mon, 8 Oct 2018 22:05:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeJICFy (ORCPT ); Mon, 8 Oct 2018 22:05:54 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91437204FD; Mon, 8 Oct 2018 18:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024766; bh=Je1ablLGKzEcNPpJgK25BJ9jYBkeBP6HwFyBZOLAJcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3dD7Fs4CkGDtF3jSK+XRaAdM3MqIYGCiIHzV4xTPXBfpcXQCQ/bMuKT3tBIzFaat 1RN8ISkeDEun1K8rVrZCd/uEd/9DZ9hEnPe3gVAmxAoX3AWUDqbG8j+3cKMlbKi5Se WKt9JRmTWqvVOFwe5ob7ZTd+7dczQuf//DL6K3w8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+376cea2b0ef340db3dd4@syzkaller.appspotmail.com, Amir Goldstein , Miklos Szeredi Subject: [PATCH 4.18 147/168] ovl: fix access beyond unterminated strings Date: Mon, 8 Oct 2018 20:32:07 +0200 Message-Id: <20181008175625.617911409@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amir Goldstein commit 601350ff58d5415a001769532f6b8333820e5786 upstream. KASAN detected slab-out-of-bounds access in printk from overlayfs, because string format used %*s instead of %.*s. > BUG: KASAN: slab-out-of-bounds in string+0x298/0x2d0 lib/vsprintf.c:604 > Read of size 1 at addr ffff8801c36c66ba by task syz-executor2/27811 > > CPU: 0 PID: 27811 Comm: syz-executor2 Not tainted 4.19.0-rc5+ #36 ... > printk+0xa7/0xcf kernel/printk/printk.c:1996 > ovl_lookup_index.cold.15+0xe8/0x1f8 fs/overlayfs/namei.c:689 Reported-by: syzbot+376cea2b0ef340db3dd4@syzkaller.appspotmail.com Signed-off-by: Amir Goldstein Signed-off-by: Miklos Szeredi Fixes: 359f392ca53e ("ovl: lookup index entry for copy up origin") Cc: # v4.13 Signed-off-by: Greg Kroah-Hartman --- fs/overlayfs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -705,7 +705,7 @@ struct dentry *ovl_lookup_index(struct o index = NULL; goto out; } - pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" + pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%.*s, err=%i);\n" "overlayfs: mount with '-o index=off' to disable inodes index.\n", d_inode(origin)->i_ino, name.len, name.name, err);