Subject: Re: [PATCH 06/17] prmem: test cases for memory protection References: <20181023213504.28905-1-igor.stoppa@huawei.com> <20181023213504.28905-7-igor.stoppa@huawei.com> <0175ca6a-40d1-0fde-350c-891488432ecb@intel.com> From: Igor Stoppa Message-ID: <1ef1168c-0c44-274a-5942-257b84609051@gmail.com> Date: Mon, 29 Oct 2018 20:16:14 +0200 MIME-Version: 1.0 In-Reply-To: <0175ca6a-40d1-0fde-350c-891488432ecb@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Dave Hansen , Mimi Zohar , Kees Cook , Matthew Wilcox , Dave Chinner , James Morris , Michal Hocko , kernel-hardening@lists.openwall.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org Cc: igor.stoppa@huawei.com, Dave Hansen , Jonathan Corbet , Laura Abbott , Vlastimil Babka , "Kirill A. Shutemov" , Andrew Morton , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org List-ID: On 25/10/2018 17:43, Dave Hansen wrote: >> +static bool is_address_protected(void *p) >> +{ >> + struct page *page; >> + struct vmap_area *area; >> + >> + if (unlikely(!is_vmalloc_addr(p))) >> + return false; >> + page = vmalloc_to_page(p); >> + if (unlikely(!page)) >> + return false; >> + wmb(); /* Flush changes to the page table - is it needed? */ > > No. ok > The rest of this is just pretty verbose and seems to have been very > heavily copied and pasted. I guess that's OK for test code, though. I was tempted to play with macros, as templates to generate tests on the fly, according to the type being passed. But I was afraid it might generate an even stronger rejection than the rest of the patchset already has. Would it be acceptable/preferable? -- igor