From patchwork Wed Jun 24 08:33:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Vagin X-Patchwork-Id: 11622593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C009913 for ; Wed, 24 Jun 2020 08:35:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC3BE2088E for ; Wed, 24 Jun 2020 08:35:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iGUU4W/h"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f0I2N5m0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC3BE2088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OiSvEtT6qklnsCHMRNFfOjJOFZoRXOzvHQSMXg07QF0=; b=iGUU4W/htS5DsSmhRWUurugGFK 96Frj52m+VDglNdAWRiMrgT+BJFmX+DbKtxWDC4mK4IhZiUdnql+5WvoMJEJ6YLgjAj6fCrcsyL4y v0s9bOt8hTvYrypO5aQQHoLntMFxby8qfUweq8IJXTxwq0xGzSQb9KYtovLL5OiE4o11MNhLDG5VP I/WblnVwRwZEWHhbniak6sgnQydYN7YesD1vjZDu1XAdRiP8Ut2TXU/i/AT3Fdy7VL41LY2AoiH87 WzckgGvvaL7WunXckWJqj4Xcdjr1pn6hBCFWvXJdiYWvjGU/k4+Wgdz3Ay91pg0Erql1ieVA9b/Cu WN/oOUYw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo0qn-0008Kn-Cf; Wed, 24 Jun 2020 08:33:45 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo0qY-0008Fy-Uj for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 08:33:31 +0000 Received: by mail-pj1-x1041.google.com with SMTP id u8so890502pje.4 for ; Wed, 24 Jun 2020 01:33:30 -0700 (PDT) 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=+phrT2AIdF4lRnMSVXuWInx9nAkEBMgCLH5q3WFhgHA=; b=f0I2N5m0fzWQAgaAToovJ+mgoHHV7sYYaDPhna45YTff7YHh0Z+1WKoPHFzeCDQ1uf eBz5MFamNgglzinB3hqAsBNG1jzQ/4rOcvpqgYHf9aMtvePAoWLBJ/PGHVh67cfqUDng WzLJVQs7gQS+sPPeDBKkHbqBAwu6AYEMSP5BMTS5I7YzfK2JREj0qLqfWOT2ax/UxLf8 jFDzntIjEjnzqf4tq9nLYdezKdRkmuWinYkNilFKVBRf+/F7OH8vrtiy9Gw7TkoB8C4z L8J+EAIpZy4EvhwSQt34sSakOsD4GC2jtggLvm6Gc0nlROno9P7xygb1qqoVJMS+L/2+ 9aGQ== 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=+phrT2AIdF4lRnMSVXuWInx9nAkEBMgCLH5q3WFhgHA=; b=SRWPAnNdYLF5QDnJ5XwfZMjkejnDuo6m+2A7L0K5fF2A2A9EsLy2Zs1ZfQrTa9WF6K KidC9co0gzceaXunEWwZoXJrmG186fDilLV7WVr0Sw4HfEr6yDVrh9hUkmEkV/yKenHn hgEOdS0PzYLz66dqdMbabL2tBJVkVDuflvEbxK/b2PFhQX1CuQi6PKMDlik92rv3dZFK 3U+GOARtvkQzxRZHWF9cWigG+Dunp22K+EPNIRy0TAWH3QYua1I1UX+c7YtJ743vHbXt 7TLT86gvib+58jjh2E5PCRghX/+qh2LZnSCsbmpVhpYXaSmrdm9Ad1oIWUDhkwz29sDu nzfg== X-Gm-Message-State: AOAM532layDdUXx1KpN3N3FxZRVqyERBNhB0VjPsthWA0F+80aSf2Rvh d1zLMLthvLlIAnJ5NjrEz4apIKXCzJY= X-Google-Smtp-Source: ABdhPJxEt2RHWxak+h/6okxR79SS4HgDc3N0nuv8EGttbDypYw9/wQ+ih8+B+khvyDujbln0caVp5g== X-Received: by 2002:a17:902:d896:: with SMTP id b22mr21427195plz.87.1592987608751; Wed, 24 Jun 2020 01:33:28 -0700 (PDT) Received: from laptop.hsd1.wa.comcast.net ([2601:600:9b7f:872e:a655:30fb:7373:c762]) by smtp.gmail.com with ESMTPSA id g17sm4558614pju.11.2020.06.24.01.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 01:33:28 -0700 (PDT) From: Andrei Vagin To: Catalin Marinas , Will Deacon , Mark Rutland Subject: [PATCH 5/6] arm64/vdso: Restrict splitting VVAR VMA Date: Wed, 24 Jun 2020 01:33:20 -0700 Message-Id: <20200624083321.144975-6-avagin@gmail.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200624083321.144975-1-avagin@gmail.com> References: <20200624083321.144975-1-avagin@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1041 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [avagin[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Safonov , linux-kernel@vger.kernel.org, Andrei Vagin , Thomas Gleixner , Vincenzo Frascino , Christian Brauner , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov 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 be9ca8c46cff..8be6bd6625db 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -224,6 +224,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 vdso_abi abi, struct mm_struct *mm, struct linux_binprm *bprm, @@ -306,6 +317,7 @@ static struct vm_special_mapping aarch32_vdso_maps[] = { [AA32_MAP_VVAR] = { .name = "[vvar]", .fault = vvar_fault, + .mremap = vvar_mremap, }, [AA32_MAP_VDSO] = { .name = "[vdso]", @@ -474,6 +486,7 @@ static struct vm_special_mapping aarch64_vdso_maps[] __ro_after_init = { [AA64_MAP_VVAR] = { .name = "[vvar]", .fault = vvar_fault, + .mremap = vvar_mremap, }, [AA64_MAP_VDSO] = { .name = "[vdso]",