From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A74C388F7 for ; Tue, 10 Nov 2020 14:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 979C02076E for ; Tue, 10 Nov 2020 14:53:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="grzTsR+K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730980AbgKJOxd (ORCPT ); Tue, 10 Nov 2020 09:53:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:47188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729898AbgKJOxc (ORCPT ); Tue, 10 Nov 2020 09:53:32 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA1C1206B2; Tue, 10 Nov 2020 14:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605020010; bh=YZY1zDR8MG28ywpvZyCPpiTF/6/QlTEkN5tAH8pKXG8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=grzTsR+KZJiNR/rPWbdduOFSX7r0lJAUHYs9y88U8Qcn877DvI8EXNt2f7vtKyQlw mgBg3ch/UYQ7NMTpEvScFOV6PKF/903cEB1lQj0g9nu52Vvc6PSS3+9tgnxFVckUVF AydmdZioinGTAPi6vpWqtnwq0ehv7/JOREH8Rl60= Date: Tue, 10 Nov 2020 15:54:26 +0100 From: Greg Kroah-Hartman To: Shuo A Liu Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sean Christopherson , Yu Wang , Reinette Chatre , Zhi Wang , Zhenyu Wang Subject: Re: [PATCH v5 07/17] virt: acrn: Introduce an ioctl to set vCPU registers state Message-ID: References: <20201019061803.13298-1-shuo.a.liu@intel.com> <20201019061803.13298-8-shuo.a.liu@intel.com> <20201109170940.GA2013864@kroah.com> <20201110131419.GG17702@shuo-intel.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110131419.GG17702@shuo-intel.sh.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 09:14:19PM +0800, Shuo A Liu wrote: > > And there really is no validation of > > any fields? > > Yes. Because HSM driver has little knowledge to do the validation. What is "HSM driver"? And you all are ready for fuzzers to break this into small pieces, right? No validation of any input parameters feels really really wrong. Best of luck! > > > +struct acrn_regs { > > > + struct acrn_gp_regs gprs; > > > + struct acrn_descriptor_ptr gdt; > > > + struct acrn_descriptor_ptr idt; > > > + > > > + __u64 rip; > > > > As these are all crossing the user/kernel boundry and then on to > > somewhere "else", you have to specify the endian of all of these, right? > > > > if not, why not? > > The hypervisor and the driver only support X86_64 platform for now. So, the > endian should be certain. Then specify it please. > > > + __u16 reserved0[3]; > > > > What does the reserved fields do? > > To keep same layout with the hypervisor. Because the structure will be > passed to hypervisor directly. > > > > > Is there a pointer to a public document for all of these structures > > somewhere? > > Unfortunately, no. I have added some documents for some strutures > in the code via kernel-doc format. Is this not the hypervisor that this code is for: https://projectacrn.org/ ? If not, what is this thing? If so, how is there not documentation for it? > > > + struct acrn_regs vcpu_regs; > > > +} __attribute__((aligned(8))); > > > > What does the alignment do here? > > The hypervisor wants to access aligned data block to improve the > efficiency. Currently, the hypervisor only runs on x86_64 platform. That's nice, but what do you think that adding this attribute to a structure provides you? Have you tested this really is doing what you think it is doing? thanks, greg k-h