[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] livepatch: account for patch offset when applying NOP patch
- To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 31 Mar 2022 08:42:47 +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=MfV2svkbKV4AHtxzQZYqSwB8DQ5JLjU1dH59H/lAJZc=; b=OWlnGFPOEdsDLVJNTpepTYg1qByZDZuL5jQxQsHsolMOVsIzwR5Rv7JGQp6vsXy29utzvMCDUCRYbnceIrQFE1IfT5y7hdspGbMLxl3ApiNjVbdiLycznENNhv8o6ozJJ7bAUcvLgsDtx93e2EkD4oRrYyF4Nhx9S4qjee1M1YUwL3zL91TCZbtYtO4dPWv4txveaGI/9a/0IdsacYXs6A5beGWKkh9VknpKW/2mgjVEro/QnBhnarGMwNLStaPYUs4qBXohHH+kP5NuhnzFVDQcV/5jewqm+xseC4QrFvJRfy2u9X9sBCfx227rYvS9cVA7wOXeyCZIHGeaPCcJcg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hd9t+0ibBe4Q49FiT/3EQ6X80V7m60zZmw+jWO1Wr+07Ff5dOQbnUshhXw5W2EiYBYdkvEzbLebA9dPVNzy9WAd3HeunmbxrtL/TVn8ssZJZ45StFK+IF7VWzdsl6piVXNHvCZcoOdeO8oiGD5ZZW1rt/Tdt6aN4CEyvndh5RcJU+3/IdGr7q1o6T4SUJpD7kdiBt74Ndnfwv4w4CSOHq/GMbYCjvcojG7YwO0FnQ5z3WQTYmoEyEo8pUM1W5iyXVOjiTyyH4TJaeIyRfXbGJtf7wO8wte16hnN+FXS405VCQXiHI3gMu23VXHA3PLDnK748+0D0p5m0zARuZHHbEQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Konrad Wilk <konrad.wilk@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Bjoern Doebel <doebel@xxxxxxxxx>
- Delivery-date: Thu, 31 Mar 2022 06:42:56 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 30.03.2022 19:04, Roger Pau Monné wrote:
> On Wed, Mar 30, 2022 at 01:05:31PM +0200,>> --- a/xen/arch/x86/livepatch.c
>> +++ b/xen/arch/x86/livepatch.c
>> @@ -157,9 +157,15 @@ void noinline arch_livepatch_apply(struc
>> * loaded hotpatch (to avoid racing against other fixups adding/removing
>> * ENDBR64 or similar instructions).
>> */
>> - if ( is_endbr64(old_ptr) || is_endbr64_poison(func->old_addr) )
>> + if ( len >= ENDBR64_LEN &&
>
> Sorry, didn't realize before, but shouldn't this check be using
> old_size instead of len (which is based on new_size)?
Yes and no: In principle yes, but with len == func->new_size in the NOP
case, and with arch_livepatch_verify_func() guaranteeing new_size <=
old_size, the check is still fine for that case. Plus: If new_size was
less than 4 _but_ there's an ENDBR64 at the start, what would we do? I
think there's more that needs fixing in this regard. So I guess I'll
make a v3 with this extra fix dropped and with the livepatch_insn_len()
invocation simply moved. After all the primary goal is to get the
stable trees unstuck.
Jan
|