Received: by 10.223.176.5 with SMTP id f5csp2631585wra; Mon, 5 Feb 2018 07:19:58 -0800 (PST) X-Google-Smtp-Source: AH8x226DFgwPyNtN46IvT7UQ7JHtingA6mMbhRV4O/eyj4FP3cP+THU7mghL9WW3xJm7YL2sJWe8 X-Received: by 10.99.105.74 with SMTP id e71mr6407422pgc.342.1517843998097; Mon, 05 Feb 2018 07:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517843998; cv=none; d=google.com; s=arc-20160816; b=jhqFaSAgjqe8oX0x5vwNaLjfllDNGwTDYE+MRtx5/1SYaLKV0zKjSVVBO6NdtS6MVC CGcc9l74Qppw7TnKjeVZ8Ras6vOPnkhLyrAvIpkXqILG5dh6+s+u+WKM4BQEyKTUJQGw HjJjsLGLfbOvIHipMZUGiSy0OaZThXOdqWBQZG6v39oHZVMYdbzWLougaF7Sgfb0raPW 0MdcrqjWh3AlezddlBPO1s+RVU50BzigGh7upF4lUyVky9lPWpzj7FA66JdTPNZeDR2V JDy9qOB8qbFt2hLGg8wSxvIR6gp5cuGM3EzE8rB3kOKwv/iYiNqU3+8leidMRu0dZfZG GbBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=2ZDpx5EBnOacrDkCCPCZT9G0J55Wakiwy/H6HCZF6sg=; b=NdudlUkXt5P6k30kTzzvXEjBjIjcJPW5+TgA4tEm0KjJ1PCNuoWL2vZVm81WMU+rXh yrZxaqKC7rMHy89eA748v6z1YzdlvFq+2/b73KjLHe5D2tNpbeQ2a1D1Yoz88JSuBjT+ QzB/Wk9KvsypZ2ps6dMZOq+WoCd4EBJQItqLTcwLH6UDJz+3t5lCXoFkgae6Q+3dUz+q VX1f5tgLlTSUz99znKvKCZcxymcd28ApF2bYnw/PXDchgOprQWH+KExfxAen+nkMknSc pa5qLjCwwg7Qw2Bvsas02RyB0SozrsFQSyjIqJDrV4UBUZ4Kd914BVXmQxdEyETCa+f+ UeIA== 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 t17-v6si3036403plo.620.2018.02.05.07.19.43; Mon, 05 Feb 2018 07:19:58 -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; 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 S1753276AbeBEPTF (ORCPT + 99 others); Mon, 5 Feb 2018 10:19:05 -0500 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:34776 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752933AbeBEPSt (ORCPT ); Mon, 5 Feb 2018 10:18:49 -0500 X-IronPort-AV: E=Sophos;i="5.46,465,1511827200"; d="scan'208";a="67289177" Subject: Re: [Xen-devel] [PATCH] [v2] xen: hypercall: fix out-of-bounds memcpy To: Arnd Bergmann , Boris Ostrovsky , Juergen Gross CC: , David Laight , Dan Carpenter , References: <20180205150340.328921-1-arnd@arndb.de> From: Andrew Cooper Message-ID: <67d8f0f1-0846-876d-d36a-c8a9f9366243@citrix.com> Date: Mon, 5 Feb 2018 15:14:29 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180205150340.328921-1-arnd@arndb.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/18 15:03, Arnd Bergmann wrote: Snipping deleted code to make things clearer: > + if (cmd > ARRAY_SIZE(physdevop_len)) > + return -ENOSYS; > > + len = physdevop_len[cmd]; > + memcpy(&op.u, arg, len); You'll want an array_nospec() or whatever its called these days.  This code is SP1-leaky. Userspace controls cmd and can retrieve len by timing how many adjacent cache lines were pulled in my memcpy(). ~Andrew