Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1195034imm; Wed, 19 Sep 2018 13:53:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaqkNeHLIpDNb2i7ZD2YCXvSC4Pc56yd5GB9fPNlJPOPFGlLLLm1NX4VHvV9bT9ZnUN/48R X-Received: by 2002:aa7:824d:: with SMTP id e13-v6mr37847897pfn.97.1537390412818; Wed, 19 Sep 2018 13:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537390412; cv=none; d=google.com; s=arc-20160816; b=Kps87nK9pwn/h2SQxYJffCfo0dQC06+0M69683vrRsHGUdB9OMgZ4yFbZ8eZgzLTh0 xsIsl1BGPp4k/HuNpXZstR2btE7dYYzJBqi6pBV7w8K4M2o4wIvLtzVPycV4P6cOSltj yvBca182uWvoXTGtWp8RypPfQpGkm41M2IlQw/+XJH73YdWVE6WAgRAzat6SmEsxHVrv WN0hCh8/OVm4vNjZONjlSI6BCaB2DiFogP6zg9H/7Oz2m3Kx4qqH/dSoVlZ3rNMlYcCJ UqmGLVufjhYnMdqyBqXdiVrwW4iUZaINylx3iWlTz6rzMnCfoHtlvhOqoLELIo8KJZyx rNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=am+xBk+R/9bruvmNQKPUrS/iZOmfupXPVgm7mOIjt2g=; b=pqZtiLCI/bBWzCeidb6F64okc4Z2eC3TgXbDCfHwWSHIgFkTwd07WDjr+fQj+/kqyF 5//Dn1KY0q8hNK+FQ1rageR8GtqxHwr3Ov/FP6LlRHlcyb0t6U1AqAdNqYsqjMLpzZ22 RWa61dqqhGdU/wpfFchaEATzCCiGIFHquasv2r6e+7v2Le93ygugLGg9H2qr3SRtpDWQ BRWfvXMn0BMwK6BJjArTBn6sFlBn4Gn1uC/YJ0taTCWM9Dq8M2vgnLpJGZBtXptSrVk4 w9ktqVCvTD8dDXuiCQlLqX3g6TzZgyzGEdfgFG15VYoEdSHbK9Qgoig3niQ3tKJ39dFE rN2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=FUo4oRF6; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24-v6si22314173pll.460.2018.09.19.13.53.17; Wed, 19 Sep 2018 13:53:32 -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=@arista.com header.s=googlenew header.b=FUo4oRF6; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732824AbeITCac (ORCPT + 99 others); Wed, 19 Sep 2018 22:30:32 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:34103 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732736AbeITCab (ORCPT ); Wed, 19 Sep 2018 22:30:31 -0400 Received: by mail-ed1-f66.google.com with SMTP id u1-v6so6052871eds.1 for ; Wed, 19 Sep 2018 13:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=am+xBk+R/9bruvmNQKPUrS/iZOmfupXPVgm7mOIjt2g=; b=FUo4oRF6ovk5j4s4ara7NOXSVcQu9YisGWLibUOwPWpu34BUaSx1s83uoIUFMW6Tai iwlrrSUcA+fRA0U8G2nY8xaAXyhTklz3BvzC8gxH0/FbZaBd5DXoS2AriIuwxrUCO3z1 RAGXn5bievUWDBTdJ99IECCnBNxfLm9AO7o8FIgIq4WCSebUlHNpo5uLv4xv1N6PIcZH /byYgRRBZVVwVY0WXWbYJPRsxxpkztFJd4OMqDg2KGKKnB08ukKBN4+JUljxHsKy9nG0 rNcoU0Zsv2G7MkNJ+KCmCglRf/WlKPQGRVLNT12MfeJEHw4JdDhWCkigJ/9fMR1LIH+6 LnKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=am+xBk+R/9bruvmNQKPUrS/iZOmfupXPVgm7mOIjt2g=; b=l0nycTTSpBZyTUvdnIlZqpdOfkDmgpHjEWDNOl/kdFRYL+6sh96Ncyju+qqsSgRKH3 kAhG5zbxf9rk1PJk/3LjH45mYlj+MvYEZxhPBznU5qIn253zza3hkawILn/aPHT6Nstu Hl1Ne/yiqbo3crEtoXhmQLesNxZw65D9ejw5aEb+MgKb6gTkaJHpwuXkbi6bUwkSensg a6+IVXs85gBAUpswue2CkowFjPveV0Ac44ZBL1DmqcV7nKuuw7ubGB5b3Su8YXqxN9FP D6lFjlQEP0qils90H78Gi9qZ5OUgdFqoU5YUzPcAiGnTKC3hftSMf/54wQV8I3bOUozT OhSQ== X-Gm-Message-State: APzg51CYtB3rN3nuU0kFOumr3ZKZU/Ql+7tZepPbxgNQU8lOD7f0PN9m /TpIx0qHY0jltJBXczbQuEGG4eC8+lQ= X-Received: by 2002:aa7:cb56:: with SMTP id w22-v6mr61029561edt.202.1537390251117; Wed, 19 Sep 2018 13:50:51 -0700 (PDT) Received: from dhcp.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id t17-v6sm1747729edb.27.2018.09.19.13.50.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Sep 2018 13:50:50 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [RFC 08/20] x86/vdso: Restrict splitting vvar vma Date: Wed, 19 Sep 2018 21:50:25 +0100 Message-Id: <20180919205037.9574-9-dima@arista.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180919205037.9574-1-dima@arista.com> References: <20180919205037.9574-1-dima@arista.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As offsets differ between time namespaces, we will need to flush vvar mapping for timens page during setns(), unshare(), clone(NEW_TIME). Forcing userspace to mremap() either all vvar or nothing and the same for munmap() will simplify searching for timens page to flush. Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 5b8b556dbb12..8cc0395687b0 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -84,6 +84,18 @@ static int vdso_mremap(const struct vm_special_mapping *sm, return 0; } +static int vvar_mremap(const struct vm_special_mapping *sm, + struct vm_area_struct *new_vma) +{ + unsigned long new_size = new_vma->vm_end - new_vma->vm_start; + const struct vdso_image *image = current->mm->context.vdso_image; + + if (new_size != -image->sym_vvar_start) + return -EINVAL; + + return 0; +} + static int vvar_fault(const struct vm_special_mapping *sm, struct vm_area_struct *vma, struct vm_fault *vmf) { @@ -142,6 +154,7 @@ static const struct vm_special_mapping vdso_mapping = { static const struct vm_special_mapping vvar_mapping = { .name = "[vvar]", .fault = vvar_fault, + .mremap = vvar_mremap, }; /* -- 2.13.6