mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Chartre <alexandre.chartre@oracle.com>
To: Eric Biggers <ebiggers@kernel.org>, x86@kernel.org
Cc: alexandre.chartre@oracle.com,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] x86/its: Fix build errors when CONFIG_MODULES=n
Date: Tue, 13 May 2025 20:06:00 +0200	[thread overview]
Message-ID: <74d81bef-c77d-4b84-a50a-665ff852fba1@oracle.com> (raw)
In-Reply-To: <20250513025839.495755-1-ebiggers@kernel.org>


On 5/13/25 04:58, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Fix several build errors when CONFIG_MODULES=n, including the following:
> 
> ../arch/x86/kernel/alternative.c:195:25: error: incomplete definition of type 'struct module'
>    195 |         for (int i = 0; i < mod->its_num_pages; i++) {
> 
> Fixes: 872df34d7c51 ("x86/its: Use dynamic thunks for indirect branches")
> Cc: stable@vger.kernel.org
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>   arch/x86/kernel/alternative.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 

Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>

alex.

> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 48fd04e90114..45bcff181cba 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -131,11 +131,13 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
>   static bool cfi_paranoid __ro_after_init;
>   #endif
>   
>   #ifdef CONFIG_MITIGATION_ITS
>   
> +#ifdef CONFIG_MODULES
>   static struct module *its_mod;
> +#endif
>   static void *its_page;
>   static unsigned int its_offset;
>   
>   /* Initialize a thunk with the "jmp *reg; int3" instructions. */
>   static void *its_init_thunk(void *thunk, int reg)
> @@ -169,10 +171,11 @@ static void *its_init_thunk(void *thunk, int reg)
>   	bytes[i++] = 0xcc;
>   
>   	return thunk + offset;
>   }
>   
> +#ifdef CONFIG_MODULES
>   void its_init_mod(struct module *mod)
>   {
>   	if (!cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS))
>   		return;
>   
> @@ -207,18 +210,20 @@ void its_free_mod(struct module *mod)
>   		void *page = mod->its_page_array[i];
>   		execmem_free(page);
>   	}
>   	kfree(mod->its_page_array);
>   }
> +#endif /* CONFIG_MODULES */
>   
>   static void *its_alloc(void)
>   {
>   	void *page __free(execmem) = execmem_alloc(EXECMEM_MODULE_TEXT, PAGE_SIZE);
>   
>   	if (!page)
>   		return NULL;
>   
> +#ifdef CONFIG_MODULES
>   	if (its_mod) {
>   		void *tmp = krealloc(its_mod->its_page_array,
>   				     (its_mod->its_num_pages+1) * sizeof(void *),
>   				     GFP_KERNEL);
>   		if (!tmp)
> @@ -227,10 +232,11 @@ static void *its_alloc(void)
>   		its_mod->its_page_array = tmp;
>   		its_mod->its_page_array[its_mod->its_num_pages++] = page;
>   
>   		execmem_make_temp_rw(page, PAGE_SIZE);
>   	}
> +#endif /* CONFIG_MODULES */
>   
>   	return no_free_ptr(page);
>   }
>   
>   static void *its_allocate_thunk(int reg)
> 
> base-commit: 627277ba7c2398dc4f95cc9be8222bb2d9477800


  reply	other threads:[~2025-05-13 18:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13  2:58 Eric Biggers
2025-05-13 18:06 ` Alexandre Chartre [this message]
2025-05-13 18:15 ` Steven Rostedt
2025-05-13 18:17 ` Steven Rostedt
2025-05-13 19:23   ` Harshit Mogalapalli
2025-05-13 19:30     ` Steven Rostedt
2025-05-13 18:54 ` Dave Hansen
2025-05-13 20:32   ` Dave Hansen
2025-05-13 21:36     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74d81bef-c77d-4b84-a50a-665ff852fba1@oracle.com \
    --to=alexandre.chartre@oracle.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®