[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/3] xen/livepatch: Fix .altinstructions safety checks


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Apr 2023 15:48:23 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FXxoCtRRqAyKfgQX8GSwGx2PQHTZBmhvzG8VLrf1QOQ=; b=g6xgGZw/VMH80AmpA0fyX9e/i+S2SQURQ62zZNpoMAPeVPDwCnoC/rEEGDDurZjxnFKpuOuyJI4Ge5btdYAwiSFnDTV/mxywsNpUMZphtzSE2WBX1xYuTFgxfj7PqKV9UB8CbQForzY4blwnDN1bLRMeEp9Cogs5rWFRp8/MB77ytg730LuzXsO+WCM0orfswQB/ldnENY3IqGygxD/nHvE4MrK85NZqFcIX+f7+tsfzdQeD6NionU2Lg+u867nJjTaa+EL/l5yUj75hJC5gSAcn+LM1OLspjUfJvCDHTqLPrsxrQZn1dmSigJNH8B5PVMijlzUL4fKzRHrSl5o89Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EMFd10JHwOy9ErWL/PJuQ9WjiekFlTH77/OueyZrzFDMop/5ggiVh7R64NKo17Xby44PYOkuPRErJ+xbbnDGSBm+wJ3dD1hF9Gohq0f92oD7Kt5RRe17J4vntN1EeqXpzlStN/ihiu+78jHwuijK13FO9LtY8IG0pnbUm4fop8Oe4KROvgZmwViHWM7r2IP7b/gtwsx05mUJrxkRnNdMl7vdJxOnydVUaYktQULU9BSNc4DUK0/mRqShszv+WathKReuM4vuafyT4ha277zIJdZAkgetwgNKT+IDy5faE2EHli1btrNVQjI/qonBeqAVCuDk+ok+ZOMAclcxz1J9bw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 17 Apr 2023 13:49:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.04.2023 15:37, Andrew Cooper wrote:
> On 17/04/2023 1:35 pm, Jan Beulich wrote:
>> On 17.04.2023 14:13, Andrew Cooper wrote:
>>> --- a/xen/common/livepatch.c
>>> +++ b/xen/common/livepatch.c
>>> @@ -803,28 +803,84 @@ static int prepare_payload(struct payload *payload,
>>>      if ( sec )
>>>      {
>>>  #ifdef CONFIG_HAS_ALTERNATIVE
>>> +        /*
>>> +         * (As of April 2023), Alternatives are formed of:
>>> +         * - An .altinstructions section with an array of struct 
>>> alt_instr's.
>>> +         * - An .altinstr_replacement section containing instructions.
>>> +         *
>>> +         * An individual alt_instr contains:
>>> +         * - An orig reference, pointing into .text with a nonzero length
>>> +         * - A repl reference, pointing into .altinstr_replacement
>>> +         *
>>> +         * It is legal to have zero-length replacements, meaning it is 
>>> legal
>>> +         * for the .altinstr_replacement section to be empty too.  An
>>> +         * implementation detail means that a zero-length replacement's 
>>> repl
>>> +         * reference will still be in the .altinstr_replacement section.
>> Didn't you agree that "will" is not really true, and it's at best "may", but
>> then also doesn't really matter here in the first place (suggesting that the
>> sentence might best be dropped, to avoid drawing attention to something that
>> might at best confuse the reader as to its relevance)?
> 
> Only that "will be at 0" wasn't actually true.

Oh, right - I'm sorry for the noise.

Jan

> Right now, the repl reference *will* be somewhere in
> altinstr_replacement.  It is discussed here because it is what the check
> enforces.
> 
> As an implementation detail, it is of course free to change in the
> future if needs be.
> 
> ~Andrew




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.