From patchwork Mon Jun 19 14:37:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 105837 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp884704obh; Mon, 19 Jun 2017 07:37:52 -0700 (PDT) X-Received: by 10.99.173.6 with SMTP id g6mr1628449pgf.1.1497883071927; Mon, 19 Jun 2017 07:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497883071; cv=none; d=google.com; s=arc-20160816; b=qg91BYc2a2S0xV3Dnawz394jmYCE5s3BzOyQr7S8cC+MfBFUp81gkEMPqPmJIaTpyi UqjVBF02y20LEmbnv5ESrqI7/KQAGQ2MHQRer3mgY+HhkHfhZOEk/ixWUwVS540veLfy 89WTHoX4peHA7Q5FSiX3GaI/KoOaAxmN5KKLwUez1JKgtanZSbiv2ZKmu2F8238WjEvl 0VGgmLgSi9kUBd7vjMxzapxp4WT0LpxBm/veHBTNQycul7GjHskndUDQbkaHdT5+/7YN pE6U/QHrCsiUCpyi3DsvvQiT+m8narb8Fltv8uGcVZWfB04nRSD2qS5JtZjvEMbdSDF5 EfIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=/5DooR4aiEjofSqqgmffLWJnaIWxvomNbpmgkpSZ3AM=; b=IF/7qoQsihQssV844HYWRK3GKfC+RTR6tP4DPzo85rLMuRf40WUi+OakEz7CIVHpE6 UdsMlA0pWS5Mr0s5P5HyBK/iDrcnrekvVOdbYDj/Hmh2tIcT0nV5reWdm9bz1Av17PuQ kiacb9J3s7jU2KH2aHlRrXAid6jQUncoUdkoL/4JBU/gQ+8AJAVbNZOgmUD2UPKKONMU f3rQf7unvN958omfGfw82cAHoKo79Vb6Dia/8Z8eDKNSs74ObjXIUQCoeY/0OwDBEmag rA3DOuaCFyZBF42feCmcHPo5HDn6lP6Qda2u0/PM2aqV2iCY5UMQ4uRO01gASKidgjrf dAxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=cTOvNzBa; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si9015897plb.313.2017.06.19.07.37.51; Mon, 19 Jun 2017 07:37:51 -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=@linaro.org header.b=cTOvNzBa; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbdFSOht (ORCPT + 25 others); Mon, 19 Jun 2017 10:37:49 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:35722 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbdFSOhs (ORCPT ); Mon, 19 Jun 2017 10:37:48 -0400 Received: by mail-wr0-f181.google.com with SMTP id y25so36584584wrd.2 for ; Mon, 19 Jun 2017 07:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/5DooR4aiEjofSqqgmffLWJnaIWxvomNbpmgkpSZ3AM=; b=cTOvNzBa1zVD3OHjZu3JrP6j7YHYKP5sGsbDi83rDhyedPuMYgxq1CGnQmdrlrX1ex LXr9f4vlqjRuZ2J0jSBRcC6FAwr9zYYdNqCtbatvAEYBHJOI10RR2XEYQJWcvm2QvHM4 lb2rDYpbdC8/jSsePe4UnrO3POzgJU9jFP04E= 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; bh=/5DooR4aiEjofSqqgmffLWJnaIWxvomNbpmgkpSZ3AM=; b=juo5+Vf9u5Zb6XJTS65GRSVfYJOiXiJncNNPBbWpBWPbYlDBOvzsepd+1x3rLhTfAY byMNQFrkfiO/UlgDU+zbh9mUwf0VwLmLD86LPNkubemlWeRIdLon2w/TAngAnW3nuz1S kUpO0Id5gzQH4cPBXRW6oYMmWLfgvv5vE/fWZjPOXvVFOJ9RXhlKfcpDaFPrxyuzRIN0 AHIQ86gfOrqXWe7pwvfcKK4vxjt8/e2LoHM9JWUx7owqpzJSbuIKvoDjwWVdWekBy2zx 3L3eC8V/PY5pnD+g7cY82CYqAiogJcg353hYvMtMdHbKWpgg6N0ETmVJJIUa4Cm8tqs7 7wlA== X-Gm-Message-State: AKS2vOzn0/cN1f/teRo/UtYbK6a7rgSE4iW35NU5f/SFTRzmsWh3asWf q90H23AfCH/Y708I X-Received: by 10.223.138.167 with SMTP id y36mr4958921wry.93.1497883066577; Mon, 19 Jun 2017 07:37:46 -0700 (PDT) Received: from localhost.localdomain (143.16.90.92.rev.sfr.net. [92.90.16.143]) by smtp.gmail.com with ESMTPSA id p87sm15605421wma.2.2017.06.19.07.37.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jun 2017 07:37:45 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arnd@arndb.de, will.deacon@arm.com, mark.rutland@arm.com, gregkh@linuxfoundation.org Cc: Ard Biesheuvel Subject: [PATCH v2] drivers/kmem: disable on arm64 Date: Mon, 19 Jun 2017 16:37:24 +0200 Message-Id: <1497883044-1276-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64, the /dev/kmem driver barely works, given that it assumes that VMALLOC_START > PAGE_OFFSET, which is not the case on arm64. Due to the dubious value of kmem on an architecture such as arm64, which is fairly new and is not as forgiving as other architectures when it comes to userland accesses to kernel memory using mismatched attributes*, let's disable it altogether if CONFIG_ARM64=y. * Mappings in the vmalloc region will be accessed using vread/vwrite when reading/writing to/from /dev/kmem, which will perform these accesses by kmap()'ing each page using writeback cacheable attributes. This will be correct in most cases, but this is not guaranteed. Signed-off-by: Ard Biesheuvel --- drivers/char/Kconfig | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 31adbebf812e..8102ee7b3247 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -17,6 +17,8 @@ config DEVMEM config DEVKMEM bool "/dev/kmem virtual device support" + # On arm64, VMALLOC_START < PAGE_OFFSET, which confuses kmem read/write + depends on !ARM64 help Say Y here if you want to support the /dev/kmem device. The /dev/kmem device is rarely used, but can be used for certain