Received: by 10.192.165.148 with SMTP id m20csp4293806imm; Mon, 30 Apr 2018 15:46:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqosItQhmvsma/GRqwj6JC7Hh3HGX8k2lJ0QBB2NJHxMzNEB3TH9Eri6VATtiKHmMaYEinA X-Received: by 2002:a17:902:82ca:: with SMTP id u10-v6mr14075207plz.160.1525128360903; Mon, 30 Apr 2018 15:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525128360; cv=none; d=google.com; s=arc-20160816; b=Ljfi79RoQDEMkp0nu5rQBTuaRnr70UZzlSL14bB30gJN++TuSL96uWLnCw7JghIELR GzrTGM3TDdSYGHsuXrZcQF3esr0W0yVHq/28lekDLznrr/tIgKJahIgz6C4fXJndBfMe QM15ttemNB1WmUtige25x44jF+lkOWAP6CwByc2TcSF8vwpCfRQya0TjBSnFhkrPS+d9 +Ev5rIGYWMhhE5pH9uylUYwTLXHMZIXZ6q7xaUKMO3hR+LUN5t9JjstwIALRc37aDUka 0AxgkcidPScGFLgc8XATuvFCNkyYdm+7m9yXJfkL+YP6HVZfJJ9l4M0Mj6hs/MhaDRx2 i5ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ky5NqZzQHBEjUFV5u55wBjJZwTtwOLXJJy4ty+irSGg=; b=uId7CXfJEVLR/rYgjQEcgWp1Nu/237aAFbYUXTlaQlpUCh7ckYzumOXqbpEgR4ZpqW PmQmq+0dNtQGFKumd29eCxCV9rXgTzm2K0CILQUrL4Jf31kMVD2KkUPw4vB10o/JYFFZ xA0ZikmPN1ZIcfOowQchNioSXdO5nW9JVHxak+vkS+QuTFcwC902vZ7vNWLkgiKlXqzE ZrphaHO0Kh4AG/iEgStKCJ+r0AzczmLBakMQiILZ9qu8ezePLOz5dZQc/XX0nwDXKqyz 5s475vtncZMEl+R2sQRg+G2hU7eb3AYg3kgvNcTdCgVrsGzG11DhtnAotHSg5BagCduH sbyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=20160920 header.b=xFw6MeA+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11-v6si302499pgu.274.2018.04.30.15.45.46; Mon, 30 Apr 2018 15:46:00 -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=@umn.edu header.s=20160920 header.b=xFw6MeA+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753953AbeD3Wo0 (ORCPT + 99 others); Mon, 30 Apr 2018 18:44:26 -0400 Received: from mta-p3.oit.umn.edu ([134.84.196.203]:36240 "EHLO mta-p3.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979AbeD3WoZ (ORCPT ); Mon, 30 Apr 2018 18:44:25 -0400 Received: from localhost (localhost [127.0.0.1]) by mta-p3.oit.umn.edu (Postfix) with ESMTP id 22CD4247 for ; Mon, 30 Apr 2018 22:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=umn.edu; h= content-type:content-type:subject:subject:message-id:date:date :from:from:references:in-reply-to:received:mime-version:received :received:received; s=20160920; t=1525128263; x=1526942664; bh=x a9aSMI0i8PolkSo4jsvSbCsEeZH+SEddWn08b5zlcg=; b=xFw6MeA+qJpeL5YT0 WARzVNMDfQ+7mhcyc7zLXaOs02LobZtbpIdBiDj+iTmAiEkzZrEiHPLnkYmkwr98 n05JkyfKX6rT4+0T2lybOqwcXhXFtWEIqjGUnM2u1gr7yulk92Zgr/rYxUXlTEqU 9+yjWwWKq/mmX5g37fFs02sxAQ1zt32KT5llfzUOoMVl7HXDje3P6O+1btvUjN4Z pK+XvEWZWwKIiKd01wyyu71M3e1q9B0e4xWte/lvB+xKmcwWcVbOu3Py9INgxeBa UhO7kwoP88ZgF3A7pcMyTLlaxdlbkOQQf29jPjTj2axb33sdV3o/QGxXB2x7/ncV s/Duw== X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p3.oit.umn.edu ([127.0.0.1]) by localhost (mta-p3.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PB1zYXybjvo9 for ; Mon, 30 Apr 2018 17:44:23 -0500 (CDT) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com [209.85.214.49]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: wang6495) by mta-p3.oit.umn.edu (Postfix) with ESMTPSA id EB2566ED for ; Mon, 30 Apr 2018 17:44:23 -0500 (CDT) Received: by mail-it0-f49.google.com with SMTP id 144-v6so11866756iti.5 for ; Mon, 30 Apr 2018 15:44:23 -0700 (PDT) X-Gm-Message-State: ALQs6tD4mXkpjaCG5kfG1m7Jdec2nRKS1fesm9oKtd8umMrCqkkRRxV8 er85Peg2qOmFULkMlytUzseSe1wogKndZTiQHpI= X-Received: by 2002:a24:68c6:: with SMTP id v189-v6mr14300153itb.61.1525128263701; Mon, 30 Apr 2018 15:44:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:6f07:0:0:0:0:0 with HTTP; Mon, 30 Apr 2018 15:43:43 -0700 (PDT) In-Reply-To: <69A8B9D9-9330-4750-BAAC-94480A1072D5@intel.com> References: <1524872704-13391-1-git-send-email-wang6495@umn.edu> <8E6ADED8-592E-4794-8CAB-913A325B1971@intel.com> <20180429132058.GB5972@kroah.com> <69A8B9D9-9330-4750-BAAC-94480A1072D5@intel.com> From: Wenwen Wang Date: Mon, 30 Apr 2018 17:43:43 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv To: "Dilger, Andreas" Cc: Greg Kroah-Hartman , "devel@driverdev.osuosl.org" , Ben Evans , Jeff Layton , Aastha Gupta , "kjlu@umn.edu" , NeilBrown , "linux-kernel@vger.kernel.org" , "Drokin, Oleg" , "lustre-devel@lists.lustre.org" , Wenwen Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 30, 2018 at 5:38 PM, Dilger, Andreas wrote: > On Apr 29, 2018, at 07:20, Greg Kroah-Hartman wrote: >> >> On Sat, Apr 28, 2018 at 04:04:25PM +0000, Dilger, Andreas wrote: >>> On Apr 27, 2018, at 17:45, Wenwen Wang wrote: >>>> [PATCH] staging: luster: llite: fix potential missing-check bug when copying lumv >>> >>> (typo) s/luster/lustre/ >>> >>>> In ll_dir_ioctl(), the object lumv3 is firstly copied from the user space >>>> using Its address, i.e., lumv1 = &lumv3. If the lmm_magic field of lumv3 is >>>> LOV_USER_MAGIV_V3, lumv3 will be modified by the second copy from the user >>> >>> (typo) s/MAGIV/MAGIC/ >>> >>>> space. The second copy is necessary, because the two versions (i.e., >>>> lov_user_md_v1 and lov_user_md_v3) have different data formats and lengths. >>>> However, given that the user data resides in the user space, a malicious >>>> user-space process can race to change the data between the two copies. By >>>> doing so, the attacker can provide a data with an inconsistent version, >>>> e.g., v1 version + v3 data. This can lead to logical errors in the >>>> following execution in ll_dir_setstripe(), which performs different actions >>>> according to the version specified by the field lmm_magic. >>> >>> This isn't a serious bug in the end. The LOV_USER_MAGIC_V3 check just copies >>> a bit more data from userspace (the lmm_pool field). It would be more of a >>> problem if the reverse was possible (copy smaller V1 buffer, but change the >>> magic to LOV_USER_MAGIC_V3 afterward), but this isn't possible since the second >>> copy is not done if there is a V1 magic. If the user changes from V3 magic >>> to V1 in a racy manner it means less data will be used than copied, which >>> is harmless. >>> >>>> This patch rechecks the version field lmm_magic in the second copy. If the >>>> version is not as expected, i.e., LOV_USER_MAGIC_V3, an error code will be >>>> returned: -EINVAL. >>> >>> This isn't a bad idea in any case, since it verifies the data copied from >>> userspace is still valid. >> >> So you agree with this patch? Or do not? >> >> confused, > > I don't think it fixes a real bug, but it makes the code a bit more clear, > so I'm OK to land it (with minor corrections to commit message per above). > > Cheers, Andreas > -- > Andreas Dilger > Lustre Principal Architect > Intel Corporation > Thanks! I will re-submit the patch with the corrected commit message. Wenwen