From patchwork Thu May 3 21:42:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 10379307 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 2A53F60159 for ; Thu, 3 May 2018 21:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A75A29272 for ; Thu, 3 May 2018 21:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E6D829285; Thu, 3 May 2018 21:42:28 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E77029272 for ; Thu, 3 May 2018 21:42:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED7106B000A; Thu, 3 May 2018 17:42:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E870B6B0010; Thu, 3 May 2018 17:42:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D78406B0011; Thu, 3 May 2018 17:42:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id 973C56B000A for ; Thu, 3 May 2018 17:42:25 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id c4so16046169pfg.22 for ; Thu, 03 May 2018 14:42:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:date:from:to :cc:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kj47aEa/Qy9giMi0yQrf/HstDuzMGlq6Ht+2IEs3IBw=; b=K/1fVMBOUAJCuA9E4hwM1prgOSlpBclrFYF/kHBNmC8MuXw2or1NVEdsFZ7DBbouow vrkyA5MBwtlkdvv95XcjN/mykV72vGiUMwwM7IzWwAWi7+NXl/R15sVYQkhuNSHt0Kyr YgJBy4ov9Q0U4YwRmLrsLl6Yg3w3R2pK+zhNFFcEFDfyqY0hO4TIyWhZ/HEmsuicBOeB YTqzitBE4qADUngwhpENZbXDBIr1RhKKv+h3Q6Dv5z5Y6QZyeDOUZW3IbodTmzW8LXLN 6fk0v5s6F5cRH8NYp7SXArK68s4bucBTkk3ZhTsY5YwxqjovW2Iy2P85EjgKe2lMrWFR GMCQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Gm-Message-State: ALQs6tBM9LsKnGanlX4JQRW6K2nUOpB5qQBP9TU58uRCFoFEd42gwuoo Te03py8XVuXV3PQgCYWGr4gseMre3RCAynPO7EjaRv9qSRrD2+RTTUZrCw+FnoIRPaXzjPoNcnt UATZjCuAPWZpe44z9R5uNadXZ3VFZnavNcAaXBrS4Ur8D+BLGmKjnnxUFDGIrscdKzQ== X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr26062292plg.393.1525383745301; Thu, 03 May 2018 14:42:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq9+p2EBKg3DeIeFhs0xTCASbCwuH3lkYx50ZRjN3emzZIvlQ+2ukunrfZ0rtofUI+GE06f X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr26062266plg.393.1525383744356; Thu, 03 May 2018 14:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525383744; cv=none; d=google.com; s=arc-20160816; b=lOtveqBnGPeNlaxJXzNYznIE23JGvaH890tSSMj1f3H1fYNBVfjFfzJ9EtZooFUOGe 9GW4qwurfw8qnaiGDGZkgsMkpNFZb0fCPqIT5IAdlKNhQwdbzbZt6W7X4sX2XtvzWZtd A0Z0Yb4IcirhOB6UcRCqa/zUnxnjYG7LocWT6kUdkkDhqQ9fFS+TqP5e9aC+BWHLCkWq o1K17IB04NxUbB/YmUU1Kdh/otKmGGW9339QF8qom1CxnHuPSBknIV13GCzpYHkZjPrh gEuhzofAPYLpj6nTfORKbYNIxRnckTI/VpOpb9DEh+LCJjglflbIVZ+DJMOvIVSAADuV iIZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=kj47aEa/Qy9giMi0yQrf/HstDuzMGlq6Ht+2IEs3IBw=; b=ob32F3/VF2L4fWCpMBDG2mztR6gxDMH2/1TWUPrRJ/CNUZqUbN2O2gq6luf5nrU1ri eiogSTyFvLAobU8w5v8Ic6udaRHndza7hIJj+Scmn/TjcMH91TwYpBEfBox4CcL6g+rz g1A5i4FPf01657zgFUVlDdMYYqUyZ1YZPEKrhLi+XPJdvOiDBrXXWQZY/bMdz6Kmp5vJ Il5SKEs8rSrlDoCMkrLY8unQ7/PCzJqq1zwVsTPWS6zWIdWVP8yv/r0801SDbhMXvHde 0wLoBUybfFdAQzhspmIAGd27bH5hC9PUDYFg9A3gCMzKI/0hw6NIMfbHMSflDSUQ7aGW jKrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id f131si8906957pfc.316.2018.05.03.14.42.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 14:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 61BC9723; Thu, 3 May 2018 21:42:23 +0000 (UTC) Date: Thu, 3 May 2018 14:42:22 -0700 From: Andrew Morton To: Chintan Pandya Cc: vbabka@suse.cz, labbott@redhat.com, catalin.marinas@arm.com, hannes@cmpxchg.org, f.fainelli@gmail.com, xieyisheng1@huawei.com, ard.biesheuvel@linaro.org, richard.weiyang@gmail.com, byungchul.park@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, khandual@linux.vnet.ibm.com, mhocko@kernel.org Subject: Re: [PATCH v2 2/2] mm: vmalloc: Pass proper vm_start into debugobjects Message-Id: <20180503144222.bcb5c63bb96309bc3b37fb6f@linux-foundation.org> In-Reply-To: <1523961828-9485-3-git-send-email-cpandya@codeaurora.org> References: <1523961828-9485-1-git-send-email-cpandya@codeaurora.org> <1523961828-9485-3-git-send-email-cpandya@codeaurora.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 17 Apr 2018 16:13:48 +0530 Chintan Pandya wrote: > Client can call vunmap with some intermediate 'addr' > which may not be the start of the VM area. Entire > unmap code works with vm->vm_start which is proper > but debug object API is called with 'addr'. This > could be a problem within debug objects. > > Pass proper start address into debug object API. > > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1124,15 +1124,15 @@ void vm_unmap_ram(const void *mem, unsigned int count) > BUG_ON(addr > VMALLOC_END); > BUG_ON(!PAGE_ALIGNED(addr)); > > - debug_check_no_locks_freed(mem, size); > - > if (likely(count <= VMAP_MAX_ALLOC)) { > + debug_check_no_locks_freed(mem, size); > vb_free(mem, size); > return; > } > > va = find_vmap_area(addr); > BUG_ON(!va); > + debug_check_no_locks_freed(va->va_start, (va->va_end - va->va_start)); > free_unmap_vmap_area(va); > } > EXPORT_SYMBOL(vm_unmap_ram); hm, how did this sneak through? mm/vmalloc.c:1139:29: warning: passing argument 1 of debug_check_no_locks_freed makes pointer from integer without a cast [-Wint-conversion] debug_check_no_locks_freed(va->va_start, (va->va_end - va->va_start)); --- a/mm/vmalloc.c~mm-vmalloc-pass-proper-vm_start-into-debugobjects-fix +++ a/mm/vmalloc.c @@ -1136,7 +1136,8 @@ void vm_unmap_ram(const void *mem, unsig va = find_vmap_area(addr); BUG_ON(!va); - debug_check_no_locks_freed(va->va_start, (va->va_end - va->va_start)); + debug_check_no_locks_freed((void *)va->va_start, + (va->va_end - va->va_start)); free_unmap_vmap_area(va); } EXPORT_SYMBOL(vm_unmap_ram);