Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4567972imm; Fri, 18 May 2018 07:15:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxJBhwQr1yvsmaH5MESyJp1HHT5RQeruLZKUfXEPT8XLUZk6HJOuasqc6Vx+wahi+jxOWa X-Received: by 2002:a65:480a:: with SMTP id h10-v6mr5235573pgs.403.1526652905617; Fri, 18 May 2018 07:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526652905; cv=none; d=google.com; s=arc-20160816; b=nSVmmDA0G2Z9AlHq/mUd8ShSNmN9Sq0N9Hg26Zb5xCun0VX+ElVmmz2KK+mWRk3xAn j6VMBZz0W2nxAdOOCmourRIpzQhui1cEIQK1Fwy//s9UtTUFCyj/1quLj952spdqik6P PxEa2GGJcfVl+a3hmtE9IO3i6TwxJTqljytMq4psmHzZSkDNm8FeGWIkyVlLEprRy5ah puO8Cr438ifXbkn8Ce599MRyb5H4286oVV6zZNiBCIROwAVg+gJhNKJ9QcJHoQYC+anA O0wugcpfv0WkjwCgzMCjNV7OIJ6TcMJrYN2Gsnm9HiGBgYM4qQr5MmzrW7PfzU9Jo469 wUTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=6NsM0Kk8LVaAmv2hSE5k2d8cspri4rPgWE185lGvCHM=; b=YaHX77/4jhtMeIFpz/kVQtUSFBRaiTxmQVsF37O53LfN7QSMsVKAKyaChRsU7gwk1r 6eG1BZ4Fq1+NkAwSTc8VMNTQRHPNras24x6ZRZsIQ4NKxLn4v4nUffMNtzMtlaJvY1Qy ZANaBVBkxtvoGaMQP+kJo6+iN3ULILnS37dy5apSaSQaqZf3ParrHnW+7IM08a57q7Yb 0dcbpvxne465yc0U2CddaNXFKDZmCalovgs7zTv+IHdwGuXl7jVlC5tsIe9z1KxjDcXL qZzsIxkFN2REqIjIrK6PxSKth2ebyZQmnaCdBmFYLRAQ9v4NXSkGcxa0Rt4BU+H+lzmf YdZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=PqxkJUwG; 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 94-v6si5168852pla.500.2018.05.18.07.14.51; Fri, 18 May 2018 07:15: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=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=PqxkJUwG; 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 S1751907AbeEROOY (ORCPT + 99 others); Fri, 18 May 2018 10:14:24 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:47012 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbeEROOV (ORCPT ); Fri, 18 May 2018 10:14:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1526652860; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=/Ikg0KBzlbQTXLFNKVqKDSZbieogKu8loRK228seliU=; b=PqxkJUwG3Oyik44P3rjqSCZvldrcZtzX+iGqXblnyNKedOgWfmxSvbuJr0x9+XMy b+lgp1xe75wMXg5yh2+iqdnw5dNy7nwJSnnyclKSwW1RUnmg74moW4UOgO30qqqyNIq BLCtTlVYHo127fOYnV2xiPfdikop9/0GZvidIIxM= Date: Fri, 18 May 2018 14:14:20 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Boaz Harrosh cc: Matthew Wilcox , Jeff Moyer , Andrew Morton , "Kirill A. Shutemov" , linux-kernel , linux-fsdevel , "linux-mm@kvack.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Peter Zijlstra , Dave Hansen , Rik van Riel , Jan Kara , Matthew Wilcox , Amit Golander Subject: Re: [PATCH] mm: Add new vma flag VM_LOCAL_CPU In-Reply-To: Message-ID: <010001637399f796-3ffe3ed2-2fb1-4d43-84f0-6a65b6320d66-000000@email.amazonses.com> References: <0efb5547-9250-6b6c-fe8e-cf4f44aaa5eb@netapp.com> <20180514191551.GA27939@bombadil.infradead.org> <7ec6fa37-8529-183d-d467-df3642bcbfd2@netapp.com> <20180515004137.GA5168@bombadil.infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.05.18-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 May 2018, Boaz Harrosh wrote: > > I don't think page tables work the way you think they work. > > > > + err = vm_insert_pfn_prot(zt->vma, zt_addr, pfn, prot); > > > > That doesn't just insert it into the local CPU's page table. Any CPU > > which directly accesses or even prefetches that address will also get > > the translation into its cache. > > > > Yes I know, but that is exactly the point of this flag. I know that this > address is only ever accessed from a single core. Because it is an mmap (vma) > of an O_TMPFILE-exclusive file created in a core-pinned thread and I allow > only that thread any kind of access to this vma. Both the filehandle and the > mmaped pointer are kept on the thread stack and have no access from outside. > > So the all point of this flag is the kernel driver telling mm that this > address is enforced to only be accessed from one core-pinned thread. But there are no provisions for probhiting accesses from other cores? This means that a casual accidental write from a thread executing on another core can lead to arbitrary memory corruption because the cache flushing has been bypassed.