> From: Andrew Cooper
> Sent: Monday, April 17, 2023 1:13 PM
> To: Xen-devel
> Cc: Andrew Cooper ; Konrad Rzeszutek Wilk
> ; Ross Lagerwall
> Subject: [PATCH v2 3/3] xen/livepatch: Fix .altinstructions safety checks
>
> The prior check has && vs || mixups
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 )
>>>
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
>> +
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),
The prior check has && vs || mixups, making it tautologically false and thus
providing no safety at all. There are boundary errors too.
First start with a comment describing how the .altinstructions and
.altinstr_replacement sections interact, and perform suitable cross-checking.
Second,