Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2682716ybt; Fri, 3 Jul 2020 16:07:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysE5IgMGYeQzKx3058f8v14rMrGm8C/3IJRHTSDfA3y2Otj+/daOggyxoEF+sSxNb8taYr X-Received: by 2002:a17:906:e089:: with SMTP id gh9mr10165290ejb.482.1593817629635; Fri, 03 Jul 2020 16:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593817629; cv=none; d=google.com; s=arc-20160816; b=gInKuLCRtmtrG78kdefkR3d5n5kHfF/oNeOTbpATeq64jFQg67C+fADtBnXoxOQuzz X5qQJeOthfmm3O83NeupaNApjpOimvIDL9V+dSL9s0no+UV8mElKd92f5GluCZc+Pfmg vHx7DsBTy+E/T0FjtIMNJNgWye4ocCjomL0azHcuv6zjbsvoEzOE0KhCzkfWLLzuvG9+ nym12D52hXRpfKc2AxLxy9zPycwnCMsmFPv8HjEsVJiQA9KfxVtwSvo/ZmcUR0tP1hQg 66pykwAZ5MuMYkrrZRMAKUAgBSNcAhDGCFcxl1806kdUEluvjRfNWymu5PnJ2pMQ9gxH 25rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=VlpBGqPjHkKv7ADx8LEf0F6DzOc+/psoZE0/LpnPTTQ=; b=0YrAz5asyw7654a6uAdTr2IS7DGfJ6meYfx7Lf3lK2IH9DYpbPJmftYRTquiOsTOBU HF3Jy2x0Hik0fIVfrN+0QZVTvUWimj0UVbhL8EsChk6n6WB39ed8l+J6icR8UX8F+0nl CzrTcajTniEeSqD6R4AToZ09Rn4n9QxiJ6xLezM1BEiQCyRHOX4NIjURpRFRoT/H1xbT 0+PHxlBW4w4nKrTKH+7PnnPxo5fZ528383OhLU2lQUk8pOLNRlO/1qwh7rc2D6r3UIcz 2YpNL8YDwx/gNaoM5/Cxz0VTIFhk9nSBdDqjdYNwi9Lfq+3L4NzSQGvbQxIPurL/0ug6 yHEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si10473090ejn.10.2020.07.03.16.06.46; Fri, 03 Jul 2020 16:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbgGCXEe (ORCPT + 99 others); Fri, 3 Jul 2020 19:04:34 -0400 Received: from mga04.intel.com ([192.55.52.120]:10153 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgGCXEe (ORCPT ); Fri, 3 Jul 2020 19:04:34 -0400 IronPort-SDR: YdTAHe3hcPFWhDYNT3f4TFRh0XJlc8ko16y62KOfDNh9e4/LVqCYoGMAQ6bN5kLxj/B4FYMsyb X8r6fs+AOgZg== X-IronPort-AV: E=McAfee;i="6000,8403,9671"; a="144722418" X-IronPort-AV: E=Sophos;i="5.75,309,1589266800"; d="scan'208";a="144722418" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2020 16:04:33 -0700 IronPort-SDR: JyuK2FYE/yBdERc+4D1NOJZ7N0JJg+gCfVSVJ/LJ4h0rRpghX+gjWdxYshCfKx1IW4im/D3h4V /WOU9Vp5CXkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,309,1589266800"; d="scan'208";a="456023767" Received: from ntohan-mobl.ger.corp.intel.com (HELO localhost) ([10.252.53.15]) by orsmga005.jf.intel.com with ESMTP; 03 Jul 2020 16:04:17 -0700 Date: Sat, 4 Jul 2020 02:04:13 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: Sean Christopherson , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Jethro Beekman , Haitao Huang , Chunyang Hui , Jordan Hand , Nathaniel McCallum , Seth Moore , Suresh Siddha , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v33 11/21] x86/sgx: Linux Enclave Driver Message-ID: <20200703230413.GA104749@linux.intel.com> References: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> <20200626091419.GB27151@zn.tnic> <20200626141627.GA6583@linux.intel.com> <20200626142019.GD27151@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200626142019.GD27151@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 04:20:19PM +0200, Borislav Petkov wrote: > On Fri, Jun 26, 2020 at 07:16:27AM -0700, Sean Christopherson wrote: > > That being said, I agree that it would be safer to move sgx_calc_ssaframesize() > > inside sgx_validate_secs() and only compute encl_size after the secs is > > validated. > Changed as if (!secs->ssa_frame_size) return -EINVAL; if (sgx_calc_ssa_frame_size(secs->miscselect, secs->xfrm) > secs->ssa_frame_size) return -EINVAL; /Jarkko