Received: by 10.223.176.5 with SMTP id f5csp2660621wra; Mon, 5 Feb 2018 07:48:22 -0800 (PST) X-Google-Smtp-Source: AH8x225uNQucOAaYX1P6tngbyEyl7upjyMVQIzb5JR3oT9aX3YUklAodrNXPeIcPN2J6YINDoXFD X-Received: by 10.99.164.25 with SMTP id c25mr2160375pgf.308.1517845702050; Mon, 05 Feb 2018 07:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517845702; cv=none; d=google.com; s=arc-20160816; b=R0O/Qz1Of2rMySQCi+N+n8/IoRcp1Hba//2VwYzyuYHOfa50lCdzBrkDlCEEFze1AA dWR5jThqWyx1HYw298K+easoFQSQbiqc0E/XrjdGx4iiCGOvJL7Rh8qjdx4X18bIf3rh JA1e3+s2xYKGuvP/L8pXk4cWE7nmo/WK2JRtfmWSgu0XSMqL+Q29xAlaTkacACh8sKJt lIVg2V6m1Vuwa1hc2EKFUnTJcnXyPdrXBdFLC3Cmv4ACvMUucMyt4r5ea8lxcCow8PjJ PZt91actfcBhXeHJ9B9+R46MCqbz/nntTiFKYhn5aQbXNWlLB5cjzuJqOdt2RWipCGHm cr8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=yk9bEc8JyoqRUrzmXcmAJVBBn0ePabLp4bwXXDjYp2Q=; b=WIrccsMzQKuLJu0p0TX49XI1Xwn9zcvSzziIXJWqXTQfxewifFeYj15mp/akeaVCt9 QrVZfrWA9f1XHmIaRwdSqIQLTW72bgppozI/PAiK0/FfgXhOgrIxgyrShziUBjNMuvB6 MZymEa7y1VLfDVt8upHKprwB3hHz7YOs5pih7JfWaIgMqTEjfm9lTnfP1IqH5M85Iadu MeD/59G4cJ9x60hWyvwSJRzuxs9QORQnLoocf/FGhhQnVXN7nL9pLsooeq0QqDnwsK99 Co+VeowogeQ5d46MhJ3guylHOt1hItLmPBHFwcl6gpCyOf/hj3ULtfXr0doXFucnIg+P E20Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ksfDuWeW; 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 s13-v6si7195608plq.557.2018.02.05.07.48.07; Mon, 05 Feb 2018 07:48:22 -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=fail header.i=@gmail.com header.s=20161025 header.b=ksfDuWeW; 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 S1753267AbeBEPr0 (ORCPT + 99 others); Mon, 5 Feb 2018 10:47:26 -0500 Received: from mail-ot0-f173.google.com ([74.125.82.173]:34026 "EHLO mail-ot0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752914AbeBEPrT (ORCPT ); Mon, 5 Feb 2018 10:47:19 -0500 Received: by mail-ot0-f173.google.com with SMTP id l10so1792930oth.1 for ; Mon, 05 Feb 2018 07:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=yk9bEc8JyoqRUrzmXcmAJVBBn0ePabLp4bwXXDjYp2Q=; b=ksfDuWeWKmIm1Jfb6dBt8D7silJSQVuZt1KCm4AOLFJOtIb0ApSyGhjIhAEEyEZnqZ OjgvHi3G1g29UEwFpQW3U5rITBmaQ345Zxmhyvfz2/VniSe9T5zRSvrAzlYUM9jJ/RLB LrqOp4hCJr0/r1fk/1CPDtoZQi/rNs4DvUdqz6O0yql9jXf/TTspNQf6D+2f4Z0IRqQI lUxCqRWSMmSUXtQveC58WRSSpRjZjOtMtAqjhPPtRSlC5nH/1vldBra4kCDd6v422P49 R9VYuxUK6mWQSlLOujsOKl3NAK/w0fxuINZYZV2qcXvmvSY9aZgqgk8CEmio0BXwoS6t 0eQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=yk9bEc8JyoqRUrzmXcmAJVBBn0ePabLp4bwXXDjYp2Q=; b=ZumX6eo9XGdiGvO1bI8kzh3UBk6HIUmT4jl6GS1j5hY8sECHXSjlA6sKB0JaRcXsDo MQ919pB1w3YMwxVAm0HGDD13LsUdgUJAeso3QZvHE0OUc5a8idq8WlK+jDpv5Zwwcu30 w4xME4ypDFfQJLcYo/kL/ld0GiXlJBrbUHSTYTaTlI4z4RQP2jiba3B9Cck/DtJZc69e 1laQSjhFCE4AjiRizNeV0WLZQ5KXY7qRCIypYGjt1e7pVdhgjmIjI1LodQmP1ivms853 BW4zazlEn3NWQTqAN9YmvgOsFf/wlG/v8MbjeuW0srMgs3KqBZ084UhDWetOpb/9ZaJd pwfA== X-Gm-Message-State: AKwxytfvkQ0gGTrKXtPLAsTENmBdTwObL7gBraS8SFSPJp9f99N+m8Nb 3NE3ISH9/pPPHS52h/kmm2sknd0JStNo37vwj7g= X-Received: by 10.157.65.176 with SMTP id p45mr22021435ote.38.1517845639281; Mon, 05 Feb 2018 07:47:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.33 with HTTP; Mon, 5 Feb 2018 07:47:18 -0800 (PST) In-Reply-To: <5A7882EA02000078001A552D@prv-mh.provo.novell.com> References: <20180205150340.328921-1-arnd@arndb.de> <5A7882EA02000078001A552D@prv-mh.provo.novell.com> From: Arnd Bergmann Date: Mon, 5 Feb 2018 16:47:18 +0100 X-Google-Sender-Auth: i-u9ytppIXJy9_X_j47qfTxnXiU Message-ID: Subject: Re: [Xen-devel] [PATCH] [v2] xen: hypercall: fix out-of-bounds memcpy To: Jan Beulich Cc: David Laight , xen-devel , Boris Ostrovsky , Dan Carpenter , Juergen Gross , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 5, 2018 at 4:14 PM, Jan Beulich wrote: >>>> On 05.02.18 at 16:03, wrote: >> int xen_event_channel_op_compat(int cmd, void *arg) >> { >> - struct evtchn_op op; >> + struct evtchn_op op = { .cmd = cmd, }; >> + size_t len; >> int rc; >> >> - op.cmd = cmd; >> - memcpy(&op.u, arg, sizeof(op.u)); >> - rc = _hypercall1(int, event_channel_op_compat, &op); >> - >> - switch (cmd) { >> - case EVTCHNOP_close: >> - case EVTCHNOP_send: >> - case EVTCHNOP_bind_vcpu: >> - case EVTCHNOP_unmask: >> - /* no output */ >> - break; >> + if (cmd > ARRAY_SIZE(evtchnop_len)) >> + return -ENOSYS; > >>= perhaps? Argh, of course. This is why I preferred the switch/case version, I knew I'd screw this up somehow ;-) Arnd