On 19/06/2024 3:44 pm, GitLab wrote:
> GitLab
> ✖     Pipeline #1338876222 has failed!
> 
>  
> Project       xen-project <https://gitlab.com/xen-project> / xen
> <https://gitlab.com/xen-project/xen>
> Branch        
>       staging <https://gitlab.com/xen-project/xen/-/commits/staging>
> 
> Commit        
>       43d5c5d5
> <https://gitlab.com/xen-project/xen/-/commit/43d5c5d5f70b3f5419e7ef30399d23adf6ddfa8e>
> 
> xen: avoid UB in guest handle arithmetic At le...
> Commit Author         
>       Jan Beulich <https://gitlab.com/jbeulich>
> 
>  
> Pipeline #1338876222
> <https://gitlab.com/xen-project/xen/-/pipelines/1338876222> triggered by
>               Ganis <https://gitlab.com/ganis>
> 
> had 1 failed job
> Failed job
> ✖     build
> 
>       debian-bookworm-gcc-arm32-debug-randconfig
> <https://gitlab.com/xen-project/xen/-/jobs/7136417308>

This is:

In file included from common/livepatch.c:9:
common/livepatch.c: In function 'livepatch_list':
./include/xen/guest_access.h:130:25: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
  130 |     __raw_copy_to_guest((void *)(d_ + (off) * sizeof(*_s)), \
      |                         ^
common/livepatch.c:1283:18: note: in expansion of macro
'__copy_to_guest_offset'
 1283 |             if ( __copy_to_guest_offset(list->name, name_offset,
      |                  ^~~~~~~~~~~~~~~~~~~~~~
./include/xen/guest_access.h:130:25: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
  130 |     __raw_copy_to_guest((void *)(d_ + (off) * sizeof(*_s)), \
      |                         ^
common/livepatch.c:1287:17: note: in expansion of macro
'__copy_to_guest_offset'
 1287 |                 __copy_to_guest_offset(list->metadata,
metadata_offset,
      |                 ^~~~~~~~~~~~~~~~~~~~~~


The problem is that (off) is of type uint64_t, so

   (const void *)(s_ + (off) * sizeof(*_d))

ends up being a uint64_t -> uint32_t down-convert in arm32.

This wants to use the _p() macro which takes care of casting through
(unsigned long) on its way to a pointer.  I'll do a patch.

~Andrew

Reply via email to