Re: [RFC PATCH v6 03/12] livepatch: Add klp-convert tool

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

 



On Wed, Feb 16, 2022 at 11:39:31AM -0500, Joe Lawrence wrote:
> diff --git a/include/uapi/linux/livepatch.h b/include/uapi/linux/livepatch.h
> index e19430918a07..2ee98e985c2a 100644
> --- a/include/uapi/linux/livepatch.h
> +++ b/include/uapi/linux/livepatch.h
> @@ -9,7 +9,17 @@
>  #ifndef _UAPI_LIVEPATCH_H
>  #define _UAPI_LIVEPATCH_H
>  
> +#include <linux/types.h>
> +
>  #define KLP_RELA_PREFIX		".klp.rela."
>  #define KLP_SYM_PREFIX		".klp.sym."
>  
> +struct klp_module_reloc {
> +	union {
> +		void *sym;
> +		__u64 sym64;	/* Force 64-bit width */
> +	};
> +	__u32 sympos;
> +} __packed;
> +
> 
> [ ... snip ... ]
> 
> diff --git a/scripts/livepatch/klp-convert.h b/scripts/livepatch/klp-convert.h
> new file mode 100644
> index 000000000000..35b9dc4e32c4
> --- /dev/null
> +++ b/scripts/livepatch/klp-convert.h
>
> [ ... snip ... ]
>
> +struct klp_module_reloc {
> +	union {
> +		void *sym;
> +		uint64_t sym64;	/* Force 64-bit width */
> +	};
> +	uint32_t sympos;
> +} __packed;

This was a hack I added to force a consistent width for the symbol
pointer in case the user was building for 32-bit.  The actual void
*sym64 value itself is not so interesting as it's only needed for the
compiler to create a relocation (later resolved by klp-convert).  That
said, sympos is used by klp-convert, and I bet it's not endian-safe
here.

Better suggestions welcome :)

-- Joe




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux