From patchwork Fri Apr 13 13:41:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Stoppa X-Patchwork-Id: 10340095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2191E604D4 for ; Fri, 13 Apr 2018 13:43:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 199762883C for ; Fri, 13 Apr 2018 13:43:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E50128845; Fri, 13 Apr 2018 13:43:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 3AED12883C for ; Fri, 13 Apr 2018 13:43:26 +0000 (UTC) Received: (qmail 30164 invoked by uid 550); 13 Apr 2018 13:43:18 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 30035 invoked from network); 13 Apr 2018 13:43:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OYIHO1E2FYttMwneu+ZKZ5RJfEzIKDHgu84G5IWf0uw=; b=Ng+NEvJaU2MGLQyJXogyk5zV0GHXzoUJ5427qOaozcvsOoioSf7SRO2P7Uocu+OWKJ b7kraVXr7Kik0wMLk9mSnPhpl0G1L+CeiX4gJNNJQg+xrVukLJUYomBxCOJ5dFijAWor 3RZ5035MdE4wqlLMbqkdfljWMnJt99jfHuQ987YETSw+TmjZ+7ZtLOsLqOLAopLqkHln m0J8Bsw9ocFdfcxyOfTiMsrGiKSLKtmRDqtXFHi2x6XqvvhSxzoVDHZAdhiT8p4J+3x1 en5DbWAKz4RFmR6uIF+S80cJPYynseZ/gr4cSe7CooYfBr/hrapRb5K9yDJd38s7ALAl kK3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OYIHO1E2FYttMwneu+ZKZ5RJfEzIKDHgu84G5IWf0uw=; b=mI10ZklVnxs0kGOeV+3eFfkhNrGkW6wXR8kCRNb0GonKsY/z8VBqEYA3oBqb9F/MPO qsUWuMKR+RPafN8wUCjNh44eEuWzeMS0S+acL8LE0iq6WfpV6Rc26YQszVSdTv+7APS0 U6RcnWiCTHIOa6VBXGAfZOOaPumcegzhzzq2pm8ZezscvK20N+3aD46MAP1V27eC/KrC vWRVhFxYmKfih8WRCLgItlEH2BlKjFzpIHJvvteZydoxHHYFIMoZ6pUFMgeERbCtukRh RR3ZJ6XJxO6RHIDZGsuUVmNIyfYWQ6uyxZGxa2A2UImXp2wcPkN3FY9+r/D2d4de3FnU DqqA== X-Gm-Message-State: ALQs6tB8NNWYiFGOptrDJQlVJ2qLvARusLwec+4DAmPCnv0iIy0IBoU2 Hh1hTMdVKetrk0w/CCrfRgI= X-Google-Smtp-Source: AIpwx4+/MtBIjqb261gxKNpqzHHlci3rWaymzEcOvddm96tLWH5Kp2MzXPdcZUm4DbJk69eroRPyFg== X-Received: by 10.46.80.14 with SMTP id e14mr3524676ljb.101.1523626986270; Fri, 13 Apr 2018 06:43:06 -0700 (PDT) From: Igor Stoppa X-Google-Original-From: Igor Stoppa To: willy@infradead.org, keescook@chromium.org, mhocko@kernel.org, corbet@lwn.net Cc: david@fromorbit.com, rppt@linux.vnet.ibm.com, labbott@redhat.com, linux-security-module@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Igor Stoppa Subject: [PATCH 2/6] vmalloc: rename llist field in vmap_area Date: Fri, 13 Apr 2018 17:41:27 +0400 Message-Id: <20180413134131.4651-3-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180413134131.4651-1-igor.stoppa@huawei.com> References: <20180413134131.4651-1-igor.stoppa@huawei.com> X-Virus-Scanned: ClamAV using ClamSMTP The vmap_area structure has a field of type struct llist_node, named purge_list and is used when performing lazy purge of the area. Such field is left unused during the actual utilization of the structure. This patch renames the field to a more generic "area_list", to allow for utilization outside of the purging phase. Since the purging happens after the vmap_area is dismissed, its use is mutually exclusive with any use performed while the area is allocated. Signed-off-by: Igor Stoppa --- include/linux/vmalloc.h | 2 +- mm/vmalloc.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 1e5d8c392f15..2d07dfef3cfd 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -47,7 +47,7 @@ struct vmap_area { unsigned long flags; struct rb_node rb_node; /* address sorted rbtree */ struct list_head list; /* address sorted list */ - struct llist_node purge_list; /* "lazy purge" list */ + struct llist_node area_list; /* generic list of areas */ struct vm_struct *vm; struct rcu_head rcu_head; }; diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 61a1ca22b0f6..1bb2233bb262 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -682,7 +682,7 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end) lockdep_assert_held(&vmap_purge_lock); valist = llist_del_all(&vmap_purge_list); - llist_for_each_entry(va, valist, purge_list) { + llist_for_each_entry(va, valist, area_list) { if (va->va_start < start) start = va->va_start; if (va->va_end > end) @@ -696,7 +696,7 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end) flush_tlb_kernel_range(start, end); spin_lock(&vmap_area_lock); - llist_for_each_entry_safe(va, n_va, valist, purge_list) { + llist_for_each_entry_safe(va, n_va, valist, area_list) { int nr = (va->va_end - va->va_start) >> PAGE_SHIFT; __free_vmap_area(va); @@ -743,7 +743,7 @@ static void free_vmap_area_noflush(struct vmap_area *va) &vmap_lazy_nr); /* After this point, we may free va at any time */ - llist_add(&va->purge_list, &vmap_purge_list); + llist_add(&va->area_list, &vmap_purge_list); if (unlikely(nr_lazy > lazy_max_pages())) try_purge_vmap_area_lazy();