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

Re: [RFC PATCH v1] arch/x86: Livepatch: fix overflow check when computing ELF relocations


  • To: Bjoern Doebel <doebel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Mar 2022 16:45:34 +0100
  • 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=03narhm58yymq5xYHn/zV15iRGoSxQQeNHULGpanEoo=; b=UH0fEfq0jlr4tE3l694Tr4xWPjCwsIQH/IRXKsUNq0wmhtgXOWoXUhBU+gmKdiy/QxdiACYI5EY6+r7BCHFEm1SKQVpo7FsYwlAzy+uFPdeLZXVL834FEdASMMlPUQ8WrM/zqVp5eMUaFcouXD2lsFrtjsGd0+KzTKxG/5oy9kKlqygYu3nInWA7IlcBdLwwlw1Ul2DDIdKZtjth/O82oycBM1L5yhai+vhIrNhG4vsAvBjdyJ59NAj+Ibn6B55+Q75is0BAodBJ7zgIwbAMhSoLh45v2memZMlNSdPYwJ8g6ww1hhscg1IGOiGP7tlW60dYfXvrtgx5IBucYg/d4w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELK4yED9EHgYea/ha8/+RjbGQD0phm3TnJB1rL/eVajachx6C69ZkhfPmcHm/sOiP0gXGk0s90/XHECz9bJaCc4ekQQatkBTqkMhJ9rfM4fcKsKQ0cuRgjjihXuiwJY2s1GCMLLoWWGxub9f94pn06gyyIbT4oBR/bz0KDiCQrhDOxo4Okc4BXuJ4p0aHyczHPY9X8d+Z1UDptkLbWqZXaqmi91tjq0nBzjlPq9PwvBnPlday+BrDNZ4nWj6kq4Unku/m3lyVOVksJB705Or3SrBQ0OKsOMGUCj4QW/IR+ZQ6s0gyWsnPJitCaxZajxYir2O0KOv/HTAwKBtWFeOEQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Michael Kurth <mku@xxxxxxxxx>, Martin Pohlack <mpohlack@xxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 08 Mar 2022 15:45:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.03.2022 16:36, Bjoern Doebel wrote:
> --- a/xen/arch/x86/livepatch.c
> +++ b/xen/arch/x86/livepatch.c
> @@ -339,7 +339,7 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
>  
>              val -= (uint64_t)dest;
>              *(int32_t *)dest = val;

Afaict after this assignment ...

> -            if ( (int64_t)val != *(int32_t *)dest )
> +            if ( (int32_t)val != *(int32_t *)dest )

... this condition can never be false. The cast really wants to be
to int64_t, and the overflow you saw being reported is quite likely
for a different reason. But from the sole message you did quote
it's not really possible to figure what else is wrong.

Jan




 


Rackspace

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