From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aravind Gopalakrishnan Subject: Re: [PATCH V2] x86, amd_ucode: Verify max allowed patch size before apply Date: Wed, 30 Apr 2014 15:13:44 -0500 Message-ID: <53615978.8040300@amd.com> References: <1398702918-12685-1-git-send-email-aravind.gopalakrishnan@amd.com> <535F78A6020000780000D340@nat28.tlf.novell.com> <53601AB9.8000907@amd.com> <53604693.7010600@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53604693.7010600@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: Thomas.Lendacky@amd.com, keir@xen.org, Jan Beulich , andrew.cooper3@citrix.com, xen-devel@lists.xen.org, Suravee.Suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org On 4/29/2014 7:40 PM, Boris Ostrovsky wrote: > On 04/29/2014 05:33 PM, Aravind Gopalakrishnan wrote: >> On 4/29/2014 3:02 AM, Jan Beulich wrote: >>>>>> On 28.04.14 at 18:35, wrote: >>>> +static bool_t verify_patch_size(uint32_t patch_size) >>>> +{ >>>> + uint32_t max_size; >>>> + >>>> +#define F1XH_MPB_MAX_SIZE 2048 >>>> +#define F14H_MPB_MAX_SIZE 1824 >>>> +#define F15H_MPB_MAX_SIZE 4096 >>>> +#define F16H_MPB_MAX_SIZE 3458 >>> Out of mere curiosity - what makes these numbers this odd? The last >>> one isn't even divisible by 4. >> >> I don't know.. >> (+Boris) : any ideas? >> > > No, I suspect some sort of design constraint. But the number is > correct, I can confirm it (for what it's worth). > > I am BTW not sure I understand the reason for verifying patch size. If > you are concerned about patch/blob corruption then IIRC HW will verify > the patch anyway and will refuse to load it if doesn't pass HW's tests. bkdg's mention something about HW performing some 'consistency checks'. A check to verify max_size could very well be one among them.. But just to be on safer side, we can have this extra sanity check in SW before applying the patch -Aravind.