From patchwork Fri Jul 5 18:55:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 168585 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3915926ilk; Fri, 5 Jul 2019 11:56:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDdBPKL0i8qwlGj1axN+odZCM+AI5jwPGqXVoCAv3c+ACude2BaZG2kTUGWCE1O1ORA0nr X-Received: by 2002:a17:902:a417:: with SMTP id p23mr6988722plq.136.1562352978475; Fri, 05 Jul 2019 11:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562352978; cv=none; d=google.com; s=arc-20160816; b=EJAhG4hNiLpy0PknJTPKhMAY99hlCf2ch8rzYRODyXGshSDf8YMRPjPGu9cXDOIKX3 CSWLH3RfDWPlAjQcIA8ijtWWy3+kvkj2pvIMoh9Zy8O7J9g0wtfN1du9PwxEFd3x229w AC22xCth1R9rTpsAWRHoIZRzaROgStrGOZ/HWRL83SHP/H0WDRaHHOOdCF9mCwf36HQi F2objYxo7W8XJaoymVLGigH6BxmxjfLsJlT5xeyEQ1hMAPRHrUtBDq11vf0Brn+iBUvB 4g910eYWZ6fYovXmNugenUTsmr/mLf2UbDwHnHNC5MTSlKFnil6e2J2XLEuU+aGdMPxm qHEQ== 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:mime-version :message-id:date:subject:cc:to:from; bh=wMDo9LCYa6eKC+umRY0sWYazIz7TTuOTpqNayerG4ig=; b=pBSx03g9YqxJpkBowGCDk43QS0swrw4JCMsXVA3p1wVtrTjkbRQgWuqSFlzmDR3AF8 T2umPl4I3rFLx7fbUl7xcdpdjA5bsHSF6cOeTbWMPT27TOya0MYDj2zNqJcOa8hy0F2m 1kTO+GsbRD69oiEb2/Xsd9GSffEHj5j5lt6JBhoMbx6zH0KLT7tsBSjkaQKnQ4mrPSza 04NDqVSKNmOqE0Z1WrU1wN8vQaHgqO/AO4CiGXahBU1hyQ4TbxtlgBuN5b6WoEKgUHG6 w/3m3trouILIAtRaNayHYkQqXDzRVTliOsAdhAPuAR1BYYKd8JTa9vgkH/1wqhTaPfHl LFTA== ARC-Authentication-Results: i=1; mx.google.com; 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 h18si8711707pjt.9.2019.07.05.11.56.18; Fri, 05 Jul 2019 11:56:18 -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; 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 S1727898AbfGES4Q (ORCPT + 30 others); Fri, 5 Jul 2019 14:56:16 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:36485 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbfGES4Q (ORCPT ); Fri, 5 Jul 2019 14:56:16 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1MFL8J-1hlPCN00kL-00FjKe; Fri, 05 Jul 2019 20:56:02 +0200 From: Arnd Bergmann To: stable@kernel.org Cc: Sasha Levin , Greg Kroah-Hartman , Kees Cook , Jisheng Zhang , Catalin Marinas , Mark Rutland , Will Deacon , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] [STABLE backport 4.9] arm64, vdso: Define vdso_{start, end} as array Date: Fri, 5 Jul 2019 20:55:50 +0200 Message-Id: <20190705185558.3655220-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:9JINqZTxsunxdoxm0iUUSQeQ4/ecEkdB/hce9tuBRM0t29UkQyB lwdaoYveWTZgF/lUUJRSrqK5WYjQEc/k/B3bNFv2gb4NGga/CJxMU+NjQfEXT5gqJQt5kuo ZIons8w8mls3aB9ApHEnSFneR8RVUzIEHFM6caPOzmfKpEPQ4qNwFkjikgCKvQzq8szf9bK I3Y3ygKkOawd/NWlaivqQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qLH4Ljn1ftU=:7RYumwgeDzndatUw45Gd63 ankahKZDnMs8XbshANZqkIXJWYw+tKq4O4ySHlOhOuVekatL3/OZ/PWpMIvepxQ4jYTTseMAL D2Lwf7INkibOSaGg1/Eoo8ClWXQZ12MdSGun7BrflypAZjXnuqosuMtplMwTkdld2cC5YvLBW tYlqcXqfkzMqdcOUpgY40AxRWxkOJj0UZmHF8S2NJqLZp9ako89YdArPE/qAdr0SdM/Xg8mDs mMzCZm5VXJbwjskhasHVFRiwYeV3GjBST+hyfwOQ7Frd9Ailqn8DVpZ8dOEIb+VfifAt4Hlz0 uMLvUpts4xuJFepYSagTZ67NegJrBfAKgVMqeXQGMnzUkK4JqzgpHK/VXRDxeeiiQa+g5Pg7C l1MWXr7PQA8AHZc1nTuYg39Ko3PbZJCNKLQZhSy6sTrPLggOQMH9Hdeg3annYY9dbfdgD+Yye l7aLSJRiCfUZA53vI51/eLHzCgsVXqAODgvOY+pe2nfVGqElXrv+JTu67RB9Rh3AwhQfBWbrO hKbKPCPGB0jPqkFh9DVefMw+lIx75MwDOF5zJJRflQRB+c1+v7Y0R+wj/bKLkVh2hvmgHcyBA q1I63aheIZu2AoC+NUmOJtYCq7eTp9TvPDcHzuuP5T9LbqdHsZVUEE9KUj6ibgdS+xOb48tai PtDKRxILS9xvJAIvdeesvCglw1pGNbAYZApVwMXppFEHlyzfXN4hnMHpwK2z9Gputf6thSCEK ZTG6x/wWfQPWxr+ozBXhNhAklu9pxcSE9y/Gsw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook Commit dbbb08f500d6146398b794fdc68a8e811366b451 upstream. Adjust vdso_{start|end} to be char arrays to avoid compile-time analysis that flags "too large" memcmp() calls with CONFIG_FORTIFY_SOURCE. Cc: Jisheng Zhang Acked-by: Catalin Marinas Suggested-by: Mark Rutland Signed-off-by: Kees Cook Signed-off-by: Will Deacon Signed-off-by: Arnd Bergmann --- Backported to 4.4, which predates the rework from 2077be6783b5 ("arm64: Use __pa_symbol for kernel symbols") and 5a9e3e156ec1 ("arm64: apply __ro_after_init to some objects") --- arch/arm64/kernel/vdso.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.20.0 diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 97bc68f4c689..908bc5ab94c1 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -36,7 +36,7 @@ #include #include -extern char vdso_start, vdso_end; +extern char vdso_start[], vdso_end[]; static unsigned long vdso_pages; static struct page **vdso_pagelist; @@ -115,14 +115,14 @@ static int __init vdso_init(void) { int i; - if (memcmp(&vdso_start, "\177ELF", 4)) { + if (memcmp(vdso_start, "\177ELF", 4)) { pr_err("vDSO is not a valid ELF object!\n"); return -EINVAL; } - vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT; + vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT; pr_info("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n", - vdso_pages + 1, vdso_pages, &vdso_start, 1L, vdso_data); + vdso_pages + 1, vdso_pages, vdso_start, 1L, vdso_data); /* Allocate the vDSO pagelist, plus a page for the data. */ vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), @@ -135,7 +135,7 @@ static int __init vdso_init(void) /* Grab the vDSO code pages. */ for (i = 0; i < vdso_pages; i++) - vdso_pagelist[i + 1] = virt_to_page(&vdso_start + i * PAGE_SIZE); + vdso_pagelist[i + 1] = virt_to_page(vdso_start + i * PAGE_SIZE); /* Populate the special mapping structures */ vdso_spec[0] = (struct vm_special_mapping) {