From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34C5FC433EF for ; Mon, 13 Jun 2022 16:50:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EC7A8D01A9; Mon, 13 Jun 2022 12:50:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 774778D01A1; Mon, 13 Jun 2022 12:50:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 614908D01A9; Mon, 13 Jun 2022 12:50:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4DE8F8D01A1 for ; Mon, 13 Jun 2022 12:50:20 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EA9E333976 for ; Mon, 13 Jun 2022 16:50:19 +0000 (UTC) X-FDA: 79573800558.20.D226E4A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id 9C1D540226 for ; Mon, 13 Jun 2022 16:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=38GMK7zc3Cm7LcXXwKmU9W4OU1b1mjrh83F5vfSCyBQ=; b=q71dZ0RNYEi0mB4pl8RDLP51wf V5nYZSKjqwvFVDZzIzL51r69+V9azDuuygaWJKoGYf1UE/SHUjjFNuez7ASDIH1X68BolKKeGk+/w VQLVowfZO0nSz6D3MaI14MCYvyUzkROJX5V7qcZLG8HiQMR5yUNmriLSkkujZFFbpaVHuFtzT9yxC cQ9ifA37KVOsjj/GMiDJKjReCuucJ8FbUwuPCFNd4n+ydLUtw4GJ2uZK9cNkfSO8IK+r/auKamYXM lv0q4/YqRNeJa17YBhCZkaQhl/1QlthBvX3Uk46Z8qsIuM/G3QUbqgvEl5pARyPuNjfHnge9sPel8 7yvj9TzQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0nB5-00H0Mg-6D; Mon, 13 Jun 2022 16:44:35 +0000 Date: Mon, 13 Jun 2022 17:44:35 +0100 From: Matthew Wilcox To: Kees Cook Cc: linux-mm@kvack.org, Uladzislau Rezki , Zorro Lang , linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 1/3] usercopy: Handle vm_map_ram() areas Message-ID: References: <20220612213227.3881769-1-willy@infradead.org> <20220612213227.3881769-2-willy@infradead.org> <202206130922.A218C4E3E8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202206130922.A218C4E3E8@keescook> ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=q71dZ0RN; dmarc=none; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655138692; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=38GMK7zc3Cm7LcXXwKmU9W4OU1b1mjrh83F5vfSCyBQ=; b=APhqqmA2teI2yF2LIV97TrKHBo2p/29xn6ng1YNC+VX4TGeHZyOkKRuhEfQ4OFf/Y4xy0e 5+1nudc7LGPWUrVNteGIdoFmOIekUmUzJLTdGOu9qPacrMZ1ltoeKmCxJLd70Oj2j66dWP izHm9sjQPQmofrTUolvyl8wqkM2JGF4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655138692; a=rsa-sha256; cv=none; b=pfT0X25SrGOztwCIsqvxR8uqtfrRPnUeKio2qZROT3h1cBZGWj3feupkHtP+zKqngzhKbg zIYbEnSnB9u0CQBYpDoVlphj9A19C/3TEEBxws81OR41FQaybnmBjcL/kONXKzvAniF+MV 4mP2pOpPC8FDJiQ2UOVX8MVsgPFFXlY= X-Stat-Signature: 9dda6kar4nkwebwrb48woit3rorroww3 X-Rspamd-Queue-Id: 9C1D540226 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=q71dZ0RN; dmarc=none; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam10 X-HE-Tag: 1655138684-998110 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 13, 2022 at 09:23:15AM -0700, Kees Cook wrote: > On Sun, Jun 12, 2022 at 10:32:25PM +0100, Matthew Wilcox (Oracle) wrote: > > vmalloc does not allocate a vm_struct for vm_map_ram() areas. That causes > > us to deny usercopies from those areas. This affects XFS which uses > > vm_map_ram() for its directories. > > > > Fix this by calling find_vmap_area() instead of find_vm_area(). > > Thanks for the fixes! > > > [...] > > + /* XXX: We should also abort for free vmap_areas */ > > What's needed to detect this? I'm not entirely sure. I only just learned of the existence of this struct ;-) /* * The following two variables can be packed, because * a vmap_area object can be either: * 1) in "free" tree (root is free_vmap_area_root) * 2) or "busy" tree (root is vmap_area_root) */ union { unsigned long subtree_max_size; /* in "free" tree */ struct vm_struct *vm; /* in "busy" tree */ }; Hmm. Actually, we only search vmap_area_root, so I suppose it can't be a free area. So this XXX can be removed, as we'll get NULL back if we've got a pointer to a free area. Ulad, do I have this right?