linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Daniel Gomez <da.gomez@samsung.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Petr Pavlu <petr.pavlu@suse.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yann Ylavic <ylavic.dev@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-modules@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v2 2/8] execmem: introduce execmem_alloc_rw()
Date: Fri, 11 Jul 2025 16:29:48 +0200	[thread overview]
Message-ID: <784081fa-0fee-4df6-b8d5-6435eead877f@kernel.org> (raw)
In-Reply-To: <20250709134933.3848895-3-rppt@kernel.org>

On 09/07/2025 15.49, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
> 
> Some callers of execmem_alloc() require the memory to be temporarily
> writable even when it is allocated from ROX cache. These callers use
> execemem_make_temp_rw() right after the call to execmem_alloc().
> 
> Wrap this sequence in execmem_alloc_rw() API.
> 
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Reviewed-by: Daniel Gomez <da.gomez@samsung.com>

> ---
> diff --git a/mm/execmem.c b/mm/execmem.c
> index 0712ebb4eb77..6b040fbc5f4f 100644
> --- a/mm/execmem.c
> +++ b/mm/execmem.c

{...}

> @@ -387,6 +397,21 @@ void *execmem_alloc(enum execmem_type type, size_t size)
>  	return kasan_reset_tag(p);
>  }
>  
> +void *execmem_alloc_rw(enum execmem_type type, size_t size)
> +{
> +	void *p __free(execmem) = execmem_alloc(type, size);
> +	int err;
> +
> +	if (!p)
> +		return NULL;
> +
> +	err = execmem_force_rw(p, size);
> +	if (err)
> +		return NULL;

You don't need to save the error here. That, allows err declaration to be
dropped.

  parent reply	other threads:[~2025-07-11 14:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 13:49 [PATCH v2 0/8] x86: enable EXECMEM_ROX_CACHE for ftrace and kprobes Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 1/8] execmem: drop unused execmem_update_copy() Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 2/8] execmem: introduce execmem_alloc_rw() Mike Rapoport
2025-07-10 13:25   ` Petr Pavlu
2025-07-11 14:29   ` Daniel Gomez [this message]
2025-07-12 10:41     ` Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 3/8] execmem: rework execmem_cache_free() Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 4/8] execmem: move execmem_force_rw() and execmem_restore_rox() before use Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 5/8] execmem: add fallback for failures in vmalloc(VM_ALLOW_HUGE_VMAP) Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 6/8] execmem: drop writable parameter from execmem_fill_trapping_insns() Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 7/8] x86/kprobes: enable EXECMEM_ROX_CACHE for kprobes allocations Mike Rapoport
2025-07-09 13:49 ` [PATCH v2 8/8] x86/ftrace: enable EXECMEM_ROX_CACHE for ftrace allocations Mike Rapoport
2025-07-10 11:18 ` [PATCH v2 0/8] x86: enable EXECMEM_ROX_CACHE for ftrace and kprobes Peter Zijlstra

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=784081fa-0fee-4df6-b8d5-6435eead877f@kernel.org \
    --to=da.gomez@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=da.gomez@samsung.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=petr.pavlu@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=ylavic.dev@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).