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 209E0C43334 for ; Mon, 13 Jun 2022 11:52:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 863C98D017D; Mon, 13 Jun 2022 07:52:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 813038D0171; Mon, 13 Jun 2022 07:52:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DAA28D017D; Mon, 13 Jun 2022 07:52:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5F5248D0171 for ; Mon, 13 Jun 2022 07:52:29 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 345F2120D15 for ; Mon, 13 Jun 2022 11:52:29 +0000 (UTC) X-FDA: 79573050018.04.496A31B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id AF6B6400A4 for ; Mon, 13 Jun 2022 11:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655121148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gYcDF7UT29qm92ngPmTzR7cWefKdcM6Ju6JodAruFT4=; b=e4qVCvDjyVNzJKfbjLcWIt4nxk8nEJJBCjLFQoAUCsdeMCoXXR1wfZh7/ypjpEjv8p4PRs O9C+i1s4lAJcBlYWSpqvbI1is60XD/S8QhPo6SUWDRljBL6daM6NwFm7Z2MDMu/1IUX/8q RxkE+4Mc+jq3ShTQ40JPUzDea8bZNH0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-185-qalXPBk7O_mvIA9yu2gtQg-1; Mon, 13 Jun 2022 07:52:25 -0400 X-MC-Unique: qalXPBk7O_mvIA9yu2gtQg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADA9080B712; Mon, 13 Jun 2022 11:52:24 +0000 (UTC) Received: from localhost (ovpn-14-0.pek2.redhat.com [10.72.14.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2D0640C1247; Mon, 13 Jun 2022 11:52:23 +0000 (UTC) Date: Mon, 13 Jun 2022 19:52:20 +0800 From: Baoquan He To: Uladzislau Rezki Cc: "Matthew Wilcox (Oracle)" , Kees Cook , linux-mm@kvack.org, 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655121148; a=rsa-sha256; cv=none; b=xhA4J7LTBao2eICRgjIUyaKoaCQsAVoDg/jKkqT31pvwJuATNo0KoSndlUJj9pk8cDuGTA 24SanhstR9mdI1JG8tbmwG/ixqkqk6e67M6Zumsnt+hxgDPLfn8Za9P6CETxr0dpLrLbRX RO4Fign+5zQ3vP8jXr7B7SJ7f3qCX+g= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e4qVCvDj; spf=none (imf01.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655121148; 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=gYcDF7UT29qm92ngPmTzR7cWefKdcM6Ju6JodAruFT4=; b=jt8AGRum3zG0rC23+wZJU/NyeJA/A6RepOZ6ntU2d20/3CVnglTTK+muWbDQU/oZYgHRmK Zji0RpJhDk28kfh90uf/k3l1xaCxPm3HUdR6KFCSp9DEmikgwoU5eToy3Vn3OwUErBwqDT 9V48uD6hk5cuyqjirdoYueJ6n+cgnKo= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AF6B6400A4 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e4qVCvDj; spf=none (imf01.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: ac4znefboye97gyihidw6woryqx95dnk X-HE-Tag: 1655121148-662946 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 06/13/22 at 12:00pm, Uladzislau Rezki 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(). > > > > Fixes: 0aef499f3172 ("mm/usercopy: Detect vmalloc overruns") > > Signed-off-by: Matthew Wilcox (Oracle) > > --- > > include/linux/vmalloc.h | 1 + > > mm/usercopy.c | 8 +++++--- > > mm/vmalloc.c | 2 +- > > 3 files changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h > > index b159c2789961..096d48aa3437 100644 > > --- a/include/linux/vmalloc.h > > +++ b/include/linux/vmalloc.h > > @@ -215,6 +215,7 @@ extern struct vm_struct *__get_vm_area_caller(unsigned long size, > > void free_vm_area(struct vm_struct *area); > > extern struct vm_struct *remove_vm_area(const void *addr); > > extern struct vm_struct *find_vm_area(const void *addr); > > +struct vmap_area *find_vmap_area(unsigned long addr); > Make it "extern" since it becomes globally visible? extern is not suggested any more to add for function declaration in header file, and removing it doesn't impact thing. > > -- > Uladzislau Rezki >