Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3722082imd; Mon, 29 Oct 2018 11:16:59 -0700 (PDT) X-Google-Smtp-Source: AJdET5c6CeJvgCnivt3FDTClhOC3f6N+XAVs9N9zMF9Uhhto+HiJdd03e3XERmUtFR6vsWS+DQVG X-Received: by 2002:a17:902:ab8a:: with SMTP id f10-v6mr15472267plr.203.1540837019224; Mon, 29 Oct 2018 11:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540837019; cv=none; d=google.com; s=arc-20160816; b=yKIH2rge9SxGcG5tewx6m3mNUFtGALzfk07EgNsnxc97UvNjKFPIhXipPB29YZxZ/m sjoymSdYFRgKrasjsBVP0M++EJWeKB0Bvh9HhzL6H0OzL4SzdrH8CyIDVr6NkeJH2LGT stnjx+CGUaRqj/RNHANfnHrPPlLymegPFUlXNMTA11AqBEp79KKXzxcRaV18whRpVHf0 3ZMxUO/i77SVAS507iYZCW/k5xSAxrFllt3TTLrXEzj5m3OqpEHi9fDh5AmcvFobe45t y25rJCEwIjrMWFFpXj5MYn1jVPXJCIdIRrsmpsTzdsI8hEeV96KVmZYLqo3lfE43o/kq piXg== 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:dkim-signature; bh=2qPBh/q69nky92IpEBTdXdD93mcC/g6otc1+JAUVzKA=; b=x77UfGM60Q5c3bHBALlcnIyj/vILqlcv3jfROg8Jsutc8VcEmsOYeF6lPY+Q/xcuft toyiE3ngJlLuiXyYhRChwvZCK//dYFslDc0fmqc6H3pzBmpsqgEs8EuOV3CdmkU95ggU 5eHR0PJ6HmQHkwfZjl4p6A7uE8s6lcIItjgPHj2L7egJ82gbghxQDH1IudXvRE2PzKTS LP2Lu1rS3kcNsuuPBSKxmruhqHt9k5HylKP3/G2cGT2jJT/7Fj4avuodQN23nbEF6MEP K2iP3bVfqVdjnG09fXfxCdzsAecbnmpRNL4QJNmKififRAYiifmF9D75N/eUEnImqmEw R8LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pnWvR3pa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16-v6si21304866pgl.462.2018.10.29.11.16.42; Mon, 29 Oct 2018 11:16:59 -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=@gmail.com header.s=20161025 header.b=pnWvR3pa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728905AbeJ3DGG (ORCPT + 99 others); Mon, 29 Oct 2018 23:06:06 -0400 Received: from mail-lj1-f173.google.com ([209.85.208.173]:39332 "EHLO mail-lj1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728891AbeJ3DGG (ORCPT ); Mon, 29 Oct 2018 23:06:06 -0400 Received: by mail-lj1-f173.google.com with SMTP id a28-v6so5755572ljd.6; Mon, 29 Oct 2018 11:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2qPBh/q69nky92IpEBTdXdD93mcC/g6otc1+JAUVzKA=; b=pnWvR3pa0Yeus7BQZPQ6Bemj50E7NWlnwuQQe4eA3B8lJ+5YtoAyu3eQoB8fihxe9t iuhebRIXMQpzgtNiU3K91YKIG2R2s9mNbpmbgPGZqg8CQivKcoQo+2Q+3jOBu8KApXCV rVbf9RRov2NpVyWRgYmlqd/dzCcyjw0ptHTAKOhxXIYhGGVbaAyGmtxOCk1R/rI3ODSp v4Pcg4CDDN2jm5hpYwjazBSoEtIija2v8rTqQ4YR8N+3OKNTWE7K8CU7BNJg4FoIp9cP 9BAIvrOom3K66kcK5C0VX3XwhIaN1OlubTAh7CCrap9yE7OBtnETRWWnHKWWNa7F8cTw TuxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2qPBh/q69nky92IpEBTdXdD93mcC/g6otc1+JAUVzKA=; b=aALuJ9+Cplfv4ZisVgAsYRGtzc12WrvstB+XODADebg0hIgXXk5IfkEC7sggPrH8nJ TVk4PbX8pVK3oBwOUHOT5aJ8XOXw6hjoan87BgeCXs0doAfTPV4DwqoHoMmineld347j L0WVKpELOfKsFPzXAoFzVQaa537K1jNghYaeKBm6yHtD7gXjzOnfz7fE50hLYLdbrVay vK5dAsTV8CX0xHbzaoPLncOhks2KXzdWZUDEx5ZM/lL6xbXwxlfSEtSbKKI2G04V8Obi IUgJCFGZIE7faKb9islRqT+kk3F3tWF22otRK62qBL4RZC+tF9OF59KYpx6W1wXFkS/h nr0w== X-Gm-Message-State: AGRZ1gLs0H+e/0FZz5pnKgrMnT4fO8Sbhd8akUDCstslgVsohugz0Jnb oLL+7A6dsomBtJFTIKuWc4zN7ATedm0xiQ== X-Received: by 2002:a2e:744:: with SMTP id i4-v6mr10225514ljd.36.1540836977341; Mon, 29 Oct 2018 11:16:17 -0700 (PDT) Received: from ?IPv6:2001:14bb:52:7be:f0bf:dd2d:f008:5213? (dmkd798g-7z2-yccwcp-4.rev.dnainternet.fi. [2001:14bb:52:7be:f0bf:dd2d:f008:5213]) by smtp.gmail.com with ESMTPSA id c19sm576788lfg.86.2018.10.29.11.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 11:16:16 -0700 (PDT) Subject: Re: [PATCH 06/17] prmem: test cases for memory protection 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 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <0175ca6a-40d1-0fde-350c-891488432ecb@intel.com> 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 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