From patchwork Wed Sep 2 19:41:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1356077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BhZBL50k2z9sTp; Thu, 3 Sep 2020 05:43:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kDYfd-0003qE-Fx; Wed, 02 Sep 2020 19:43:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kDYfc-0003pz-Dk for kernel-team@lists.ubuntu.com; Wed, 02 Sep 2020 19:43:48 +0000 Received: from mail-qv1-f72.google.com ([209.85.219.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kDYfc-0004n0-3i for kernel-team@lists.ubuntu.com; Wed, 02 Sep 2020 19:43:48 +0000 Received: by mail-qv1-f72.google.com with SMTP id y2so435721qvs.14 for ; Wed, 02 Sep 2020 12:43:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y+JmzZwdtHhOEsr7n1ucem2zNxeKMI2Q/E5XLGk4FBQ=; b=YfVeYvW9fkDlVcKbUVLmHfhUYVSw56/Kazfw4vxuDzJeoOWtp5lGt5KyL/FdQWY9Ro n7ozxEFJ8uijvREGczS9p+YREJZW5WnN7pFnPsE8f5Y0kQRxbAIpgB8Rb+yjlFa5Y5Yt mUX4jGf7kSVhr9SdjATL6OfWyfwjV7/lhWtq36X2K3etDi4A+8tmYVoVYB5SIGyCPubY mwedeuvrqRRtMXiEV/lGjpDEbY7R9WwhyXh+p54VH01Mgq9b8e4cziprmGDEoPghC1x8 mbOJTIaldNqR5qOHUNscUTebBWV47jEU6YygYmhIlp2dDO6Q1fl+vToMiaHsCX75yNI/ +7Hw== X-Gm-Message-State: AOAM531qzaXCXtRCaJQ4V21Yj6MS3dG/RIAUmfRbonSbzs+ghm2wH4JD RuSU6zirMQqMmp9TGb24DgAZLGH2UX5Qobiarslh8G9BBRA6YEtImRM0ctqeIKp3Cr4PIftcSvt mkgKfWPav6B0CqQhhsKJMPBuEWdYYmM9l6sLipRxrBg== X-Received: by 2002:ad4:4ae1:: with SMTP id cp1mr8335076qvb.216.1599075826997; Wed, 02 Sep 2020 12:43:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziDBEnXnazX85RTMO0T4UpS+LiM2eBqFsEPNiCwL9xsz8E0KM8gC+jLKCmfMLEPlgd/TVqPQ== X-Received: by 2002:ad4:4ae1:: with SMTP id cp1mr8335059qvb.216.1599075826711; Wed, 02 Sep 2020 12:43:46 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id k63sm478635qkf.33.2020.09.02.12.43.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 12:43:46 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [SRU][XENIAL][CVE-2018-10322][PATCH v2 1/4] libxfs: synchronize dinode_verify with userspace Date: Wed, 2 Sep 2020 15:41:35 -0400 Message-Id: <20200902194139.67480-2-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200902194139.67480-1-william.gray@canonical.com> References: <20200902194139.67480-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Darrick J. Wong The userspace version of _dinode_verify takes a raw inode number instead of an inode itself. Since neither version actually needs the inode, port the changes to the kernel. This will also reduce the libxfs diff noise. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner CVE-2018-10322 (backported from commit 420fbeb4bff483d89dd8de9242b8fd83e2eb3527) [ vilhelmgray: context adjustment ] Signed-off-by: William Breathitt Gray --- fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 7183b7ea065b..bcf233337724 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -293,7 +293,7 @@ xfs_dinode_to_disk( static bool xfs_dinode_verify( struct xfs_mount *mp, - struct xfs_inode *ip, + xfs_ino_t ino, struct xfs_dinode *dip) { if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC)) @@ -316,7 +316,7 @@ xfs_dinode_verify( if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize, XFS_DINODE_CRC_OFF)) return false; - if (be64_to_cpu(dip->di_ino) != ip->i_ino) + if (be64_to_cpu(dip->di_ino) != ino) return false; if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid)) return false; @@ -394,7 +394,7 @@ xfs_iread( return error; /* even unallocated inodes are verified */ - if (!xfs_dinode_verify(mp, ip, dip)) { + if (!xfs_dinode_verify(mp, ip->i_ino, dip)) { xfs_alert(mp, "%s: validation failed for inode %lld failed", __func__, ip->i_ino);