Received: by 10.192.165.148 with SMTP id m20csp385426imm; Thu, 3 May 2018 22:56:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpyaZU4xZ0N40a5cvokyx+Z5NdU/rHePLNuFthAR59kXmtUjjzSWtY4g373YDuT7YFMLoem X-Received: by 2002:a17:902:6045:: with SMTP id a5-v6mr26346557plt.138.1525413365561; Thu, 03 May 2018 22:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525413365; cv=none; d=google.com; s=arc-20160816; b=BBlcCz9ImLsORVhgGR6G0F9nPXsosCC1sYNdGVsufLNejZmQdasLPiqErwv3YHW9lv gTW/G524e8m5OATo2AbcDD6NiY6azPEnAnDpHRho1fAnbY+LS9XUhp/oIyB7RZYOwEqI uDaGpDTqgLNLQjoshNDynDYccGiNNTMw6WsTGlxTrFbd7n3iOy+GORVZknoW9khUR2me uyzQrJgMq1F3cXfot4F7jMf93LeFeBwchfxGQbHHxVXBZUQw6KHGbbf27pO7xvVD4JOO X1npGG9FKKlkxEuuLLUBGukL4k9cF1ZEtTZR6wmZkCV6JDA6POg4yJcsz8jli3TH51rT 4MfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=ZuExG9dM0EaP6GgYtMcgnrcnOQMFgJX33yVdxSivWR8=; b=X8moeJO4IQP3C/bSqjjB8fkm8vyLd7AQtSNqtnt1No/brerPSaBoob63VXofK5rI99 JhenXbav7JNPCAKZTlukBePI0P3uD3yoj3k+o3Y5Nf2n88oZcMjSi7BK7/tKPPZRWcpy 6N8eRpfJA6Ezf6PbSQ0wvF1nCLcavg98X0rvQVXiRQhRpjAdmebWRkAWci7KJY2qMx/M PQC/JO80DHtTbZZvdoM0YgdKclcZlIQHmtwSH13bwsrabZeGYT4HByyWu8TqREpHgGs5 sJlXcOChbl19X9j+LWNYcQ+cSO/7G+LDZgk5Uj0vkN9+LW094tRXV9O2cBooZITx3jbg FBdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=WH+qDbtV; dkim=pass header.i=@codeaurora.org header.s=default header.b=MOT4wXmq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2-v6si12304313pgq.278.2018.05.03.22.55.51; Thu, 03 May 2018 22:56:05 -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=@codeaurora.org header.s=default header.b=WH+qDbtV; dkim=pass header.i=@codeaurora.org header.s=default header.b=MOT4wXmq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751308AbeEDFzj (ORCPT + 99 others); Fri, 4 May 2018 01:55:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33258 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbeEDFzi (ORCPT ); Fri, 4 May 2018 01:55:38 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D6D1060C64; Fri, 4 May 2018 05:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525413337; bh=1IwUTIEYdOHB68uK9QWdDk1f4XCZmaiWnZtujbtr300=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WH+qDbtVRNxmAXtbULlztx3ZEfwHA/cFmnXjaVBrfL0rsBVwekcrJaUyJkYstC5jA OD5YSmB3E/2L6MAOgNP6Z9MLMxXi3hF0K3BYWWbiyFCQCQtA+rHnyz99CpoKPUjVHY T9V806pTLKb1ko7I0sCpwUcN6NiN3pKCBihM6Zxc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.109] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C83966055D; Fri, 4 May 2018 05:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525413336; bh=1IwUTIEYdOHB68uK9QWdDk1f4XCZmaiWnZtujbtr300=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=MOT4wXmqNlhClJq1zMCbzVH/bEcVNW5KbcplDfNOsNY/rtRLBp0uqkiaAqfP4vXUG S/D3TJHi5Syu9vyJxpah0DzSmgxn55HWAb+l2ueE2aGwI1DjY8CbwIWnKesiU2RAu4 lCL+YAMR6iarYDlRZzEFA6BOUoNvlcEchPXxUjpY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C83966055D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org Subject: Re: [PATCH v2 2/2] mm: vmalloc: Pass proper vm_start into debugobjects To: Andrew Morton 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 References: <1523961828-9485-1-git-send-email-cpandya@codeaurora.org> <1523961828-9485-3-git-send-email-cpandya@codeaurora.org> <20180503144222.bcb5c63bb96309bc3b37fb6f@linux-foundation.org> From: Chintan Pandya Message-ID: <26e3342d-b518-1e16-25ca-3c2f0ef077d4@codeaurora.org> Date: Fri, 4 May 2018 11:25:25 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180503144222.bcb5c63bb96309bc3b37fb6f@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/4/2018 3:12 AM, Andrew Morton wrote: > 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? My bad. I had tested them but missed bringing these compile fixes to the patch file. Will be careful next time. > > 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); > Chintan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project