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

Re: [PATCH v2] livepatch: apply_alternatives() is only used for livepatch


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 7 Jun 2023 11:27:58 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=Zf6HOy8l9I2/Q878vB2/jqKosS5kysyoc1OjHEG+dOA=; b=gqIG+kofKvINr3l9OeXlcunDLPWfygFPyiRKI4M0mIrtUd8DW6Wl/GShaRm9XMFw3jc02b8UroWqXFQ34HsraUrJvprLjgFW3BWauKlFxe8p39DX8B5jnH9czVzvUtp5p0dyzvX/HDofFDE06RcxTEMqWJjdXYbji48auckPAcCYSBt3+Bw7YolXmzRKBux/uty/60gA3U+3zbvjpNlcGIJ/oqXCdbhbqGfDBnrLpn5ZqSjgPxSC2Bv7omISgPW3ROpoIGmTJoqrhDjbDUwZ8eGnRwmRUY7qGalXaXh7nNRdX2g9iUyFS0BeoRdwZxZFJp3vAV+avMwc+yom/Kml5A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OGtRE38DiK3FhWlwAN00kNZyXePem5i/OevOWk67de1f6HubN1wf3oHMpbNIa/L5/+I3L6uGbw8KCFVTBZtARB4Tg14wbavNdA8N6LqcYsVDeouRNbO/AKyg3Oj0jOXJemr+r7QyuokTUzeVZdc22XkQrAQ1dz0tS7MicqGO0d4Sk2F9V9OZvrDinLsYj9k/pya0/FAj0Yt2+B4cu6516YhloO+9++Sm3gqCkBoSmWRzqJnCnbAUQNXf6cA6tvm2gDVvskDBNN8uovHJXk45O/5gP3fpTDg8PgTdSuT6LGBh/vPvf4leh8EzaqKh7+E/9buP4q4itGPu+GSydwcdqg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 07 Jun 2023 10:28:34 +0000
  • Ironport-data: A9a23:4p/qqqgSD5/l2HyFgDI9iodSX161/BEKZh0ujC45NGQN5FlHY01je htvXTiFPayNZ2CkeownbYmyph8H7MfVmtRqHVNp+XowRnkb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmYpHlUMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsx+qyq0N8klgZmP6sT4geBzyB94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQdFzIoMUqiqd7t57+dW7crr5V6DfPSadZ3VnFIlVk1DN4AaLWaGuDhwoYd2z09wMdTAfzZe swVLyJ1awjNaAFOPVFRD48imOCvhT/0dDgwRFC9/PJrpTSMilEvluGybrI5efTTLSlRtm+eq njL4CLSBRYCOcbE4TGE7mitlqnEmiaTtIc6TeTkqqYy3QLMroAVIDkpC3Xjrev+tnSnB4tOC XEouS4HqKdnoSRHSfG4BXVUukWsvBQRRt5RGO0S8xyWx+zf5APxLnMfUjdLZdgitck3bT8nz FmEm5XuHzMHmL+ITXOQ8J+EoDX0PjIaRUcIaDUYVwID75/mqZsqkxPUZt95Fei+ididMQ/3x zeGvS0vnYI5hMQA17i41V3fijfqrZ/MJiYq4i3HU2Tj6Rl2DKanaJah7Vzz5PNJPoGfCFKGu RAsi8WYqewDE5yJvCiMW/kWWqGk4e6fNz/RikIpGIMunwlB4FamdIFUpTp5fUFgN59dfSezO RCN/wRM+JVUIX2mK7dtZJ68ANgryq6mEsn5UvfTbZxFZZ0ZmBK7wRyCrHW4hwjF+HXAW4lmU XtHWa5A1UonNJk=
  • Ironport-hdrordr: A9a23:lehyJKlUiwu4u5LbBt3+I1MjyB/pDfLc3DAbv31ZSRFFG/Fw9/ rCoB17726StN91YhsdcL+7V5VoLUmzyXcx2/hzAV7AZniDhILLFuFfBOLZqlWNJ8S9zJ8+6U 4JScND4bbLfD1HZKjBgTVRE7wbsaW6GKLDv5ag85+6JzsaFZ2J7G1Ce3em+lUdfnghOXKgfq DsnPauoVCbCA0qR/X+PFYpdc7ZqebGkZr3CCR2eiLOuGG1/EuVAKeRKWni4isj
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07/06/2023 11:19 am, Jan Beulich wrote:
> On 07.06.2023 11:17, Roger Pau Monné wrote:
>> On Wed, Jun 07, 2023 at 11:10:27AM +0200, Jan Beulich wrote:
>>> On 07.06.2023 11:01, Roger Pau Monne wrote:
>>>> Guard it with CONFIG_LIVEPATCH.  Note alternatives are applied at boot
>>>> using _apply_alternatives().
>>>>
>>>> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>>>> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
>>> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
>>> albeit the implicit ack therein is only on the assumption that (apart
>>> from me) it is generally deemed better ...
>>>
>>>> --- a/xen/arch/x86/alternative.c
>>>> +++ b/xen/arch/x86/alternative.c
>>>> @@ -358,11 +358,12 @@ static void init_or_livepatch 
>>>> _apply_alternatives(struct alt_instr *start,
>>>>      }
>>>>  }
>>>>  
>>>> -void init_or_livepatch apply_alternatives(struct alt_instr *start,
>>>> -                                          struct alt_instr *end)
>>>> +#ifdef CONFIG_LIVEPATCH
>>> ... to have the #ifdef than the init_or_livepatch attribute.
>> But the init_or_livepatch attribute doesn't remove the function when
>> !CONFIG_LIVEPATCH,
> Yes up to here.
>
>> so it's not a replacement for the ifdef.
> That depends how you look at it. We don't meaningfully care about a
> few extra bytes in .init.text, I think. So it really is the Misra
> requirement of not having unreferenced symbols which makes the
> difference here.

A different option, which I've recommended before for other reasons, is
to build with function/data sections (already supported for livepatch),
and use --gc-sections at link time.

That would remove examples like this from the final binary, and there's
probably wiggle-room at the MISRA level to say "we comply with this
because the linker deletes it".

~Andrew



 


Rackspace

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