Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3354066ybv; Mon, 24 Feb 2020 23:38:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwlSzs20/1wZ7rOGrWq1gzP3EOO2Vmgybh+E0pb37zouBSzPmdEm6X21qwBRpzxvsorgY0F X-Received: by 2002:aca:4ace:: with SMTP id x197mr2561810oia.23.1582616314791; Mon, 24 Feb 2020 23:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582616314; cv=none; d=google.com; s=arc-20160816; b=AN5rYqWS5DG26MYn2Omt/7kSBGj+seZp6CAhpCCb6N2T4fPiXSRONh54Zke7oeQXVM 4DtOHskcyumJWPKP/NILG+LejMqMQj08l4KlIbG84O7ivAV2lAw/Gjey0y3MgXyXbbRU GFQ3tGLw7VkhdXqLePzhzGWam1uk0cQloUg0iqBcpLjYVehoVRa4jDw97+ziSI4T1UEa UxCHQsYiohZPo7vs6fXL17wQ9E/uzARnqxlsN3QA3d69Jp1aoUp92CpDYnhycsHKFdQ5 t+FvqM7OVSrCNOody1h9wD02qcdcSeF9X8G6vZMLFU/8OIZxQpX6n4TLopa28bUAegG5 8+kw== 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=Ug72A/vgrdmHIVdpr3zMNCL3H56NFZ8NAXeJKxd5VIo=; b=UhF1zJGZoRiz39Ig2vSmrIbbDO8WudmNRTA9msFkiY6aAAKEicULXyincv001QjDYb JTK/AkjgiWdIY1exILNi/p5btijA37zOHbQidpubrBQibVnB6ehd11/EfqjEmZ5a14ZM UBsgLvEOULOW2xdvkItFaedMLdmw0C4buFuu+Bbd+H+cWaUyIB4cm7x6RHfFGyUl6e3f GHTWig6Kug+rHvaY67q5ysz1RAjfDAh9h54mxAdmPPBFH1HkhXEh6wf83VRdSjN8Q+jb adcoJH6d2G32ZOww3KOr4zcga6D2u516vYqEonJGbLmn6tkNwEkFyEZocb6P+lr8bTz5 tpvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pDEi1gYl; 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 i6si8534413otj.24.2020.02.24.23.38.23; Mon, 24 Feb 2020 23:38:34 -0800 (PST) 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=pDEi1gYl; 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 S1729528AbgBYHh4 (ORCPT + 99 others); Tue, 25 Feb 2020 02:37:56 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45680 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729481AbgBYHhs (ORCPT ); Tue, 25 Feb 2020 02:37:48 -0500 Received: by mail-pf1-f193.google.com with SMTP id 2so6701559pfg.12 for ; Mon, 24 Feb 2020 23:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ug72A/vgrdmHIVdpr3zMNCL3H56NFZ8NAXeJKxd5VIo=; b=pDEi1gYlasNmPGrqygmBasm60r/FtjxKJbgu4k+fU01Lpbbws9FwI+l0FyggrMrfw8 0TywUcVUcE6eDH/x1tLCESNAOLg5GflR/tj1V62c4ij6I0lqgBQCuSOB0ZEO4LteZdlj lCamjaH8M6JaLgIu50NR1uYkqcxu/vEJNkUeYLwHCKUrGVYrDjEdUg4CJBiLgwgRV8EM 21cz3AhcL/QT09ImUvOvYnfvW7gSxFXeQJ9BePtmuJbMsKdK4I9GO55KmKdzYFu6Gxr8 E8/GMCSYYqKE5Z0UJJP3Tp2X+lv0AcZo20RDJwsgdK3zNUZEv7fyreYvwuC5JS86DFxJ Y6Xg== 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=Ug72A/vgrdmHIVdpr3zMNCL3H56NFZ8NAXeJKxd5VIo=; b=dUdxV7Swsq/CeJd2YqvTVnnMYA+Ee9Ut6+WlkQzesx6uKmJkU5XNvJkOTWxK3CvxjM 5b4B/H7IrifzVZhDT/3TSQADQd+6Cad4hQ2fzj64RMmJGqckCEEwFcfUU+OdZiuTK/lH nXDqD3tzMZ+8m5kjrP2BpKq3yv4znWum4PgRQPPDUgKO6UPX1Azck5SiSHd4PxNqPaVn h6XcGYcBhdmwjNMmY98kx9pAVO60+dBq5bnuPdFivL1WCpHdYPtLONj5Nn4bCGHrdcyI yP5PDbeTjd4dIPDV3gGS3i8PKkD6mGanzALGy4QXf7bHcvxQWQaQP/BYBsVfi/tjej41 gwqQ== X-Gm-Message-State: APjAAAXw9AL5fJ2wKAJ4lrSk7JGazh5XKXq98CioRL4pkc9oRdhFWvrM j/Enbsa7BbT+pQBtdHpCymE0DaBF X-Received: by 2002:a63:d845:: with SMTP id k5mr54501802pgj.183.1582616265720; Mon, 24 Feb 2020 23:37:45 -0800 (PST) Received: from laptop.hsd1.wa.comcast.net ([2601:600:817f:a132:df3e:521d:99d5:710d]) by smtp.gmail.com with ESMTPSA id m128sm15979390pfm.183.2020.02.24.23.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 23:37:45 -0800 (PST) From: Andrei Vagin To: Vincenzo Frascino Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrei Vagin , Thomas Gleixner , Dmitry Safonov Subject: [PATCH v2 5/6] arm64/vdso: Restrict splitting VVAR VMA Date: Mon, 24 Feb 2020 23:37:30 -0800 Message-Id: <20200225073731.465270-6-avagin@gmail.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200225073731.465270-1-avagin@gmail.com> References: <20200225073731.465270-1-avagin@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Forbid splitting VVAR VMA resulting in a stricter ABI and reducing the amount of corner-cases to consider while working further on VDSO time namespace support. As the offset from timens to VVAR page is computed compile-time, the pages in VVAR should stay together and not being partically mremap()'ed. Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index fb32c6f76078..c003f7ee383a 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -235,6 +235,17 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm, return vmf_insert_pfn(vma, vmf->address, pfn); } +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; + + if (new_size != VVAR_NR_PAGES * PAGE_SIZE) + return -EINVAL; + + return 0; +} + static int __setup_additional_pages(enum arch_vdso_type arch_index, struct mm_struct *mm, struct linux_binprm *bprm, @@ -315,6 +326,7 @@ static struct vm_special_mapping aarch32_vdso_spec[C_PAGES] = { { .name = "[vvar]", .fault = vvar_fault, + .mremap = vvar_mremap, }, { .name = "[vdso]", @@ -497,6 +509,7 @@ static struct vm_special_mapping vdso_spec[A_PAGES] __ro_after_init = { { .name = "[vvar]", .fault = vvar_fault, + .mremap = vvar_mremap, }, { .name = "[vdso]", -- 2.24.1