mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <mpdesouza@suse.com>
To: Lukas Hruska <lhruska@suse.cz>, Petr Mladek <pmladek@suse.com>,
	Miroslav Benes <mbenes@suse.cz>,
	Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
	live-patching@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH v1 1/5] livepatch: Create and include UAPI headers
Date: Wed, 10 Jan 2024 10:38:52 -0300	[thread overview]
Message-ID: <96578fb7568a8c2a318c850e6979bbf8f58cc249.camel@suse.com> (raw)
In-Reply-To: <20231106162513.17556-2-lhruska@suse.cz>

On Mon, 2023-11-06 at 17:25 +0100, Lukas Hruska wrote:
> From: Josh Poimboeuf <jpoimboe@redhat.com>
> 
> Define klp prefixes in include/uapi/linux/livepatch.h, and use them
> for
> replacing hard-coded values in kernel/livepatch/core.c.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> Signed-off-by: Lukas Hruska <lhruska@suse.cz>

Reviewed-by: Marcos Paulo de Souza <mpdesouza@suse.com>

> ---
>  MAINTAINERS                    |  1 +
>  include/uapi/linux/livepatch.h | 15 +++++++++++++++
>  kernel/livepatch/core.c        |  5 +++--
>  3 files changed, 19 insertions(+), 2 deletions(-)
>  create mode 100644 include/uapi/linux/livepatch.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4cc6bf79fdd8..11a2d84c1277 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12130,6 +12130,7 @@ F:	Documentation/ABI/testing/sysfs-
> kernel-livepatch
>  F:	Documentation/livepatch/
>  F:	arch/powerpc/include/asm/livepatch.h
>  F:	include/linux/livepatch.h
> +F:	include/uapi/linux/livepatch.h
>  F:	kernel/livepatch/
>  F:	kernel/module/livepatch.c
>  F:	lib/livepatch/
> diff --git a/include/uapi/linux/livepatch.h
> b/include/uapi/linux/livepatch.h
> new file mode 100644
> index 000000000000..e19430918a07
> --- /dev/null
> +++ b/include/uapi/linux/livepatch.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +
> +/*
> + * livepatch.h - Kernel Live Patching Core
> + *
> + * Copyright (C) 2016 Josh Poimboeuf <jpoimboe@redhat.com>
> + */
> +
> +#ifndef _UAPI_LIVEPATCH_H
> +#define _UAPI_LIVEPATCH_H
> +
> +#define KLP_RELA_PREFIX		".klp.rela."
> +#define KLP_SYM_PREFIX		".klp.sym."
> +
> +#endif /* _UAPI_LIVEPATCH_H */
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index 61328328c474..622f1916a5c8 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -20,6 +20,7 @@
>  #include <linux/completion.h>
>  #include <linux/memory.h>
>  #include <linux/rcupdate.h>
> +#include <uapi/linux/livepatch.h>
>  #include <asm/cacheflush.h>
>  #include "core.h"
>  #include "patch.h"
> @@ -226,7 +227,7 @@ static int klp_resolve_symbols(Elf_Shdr *sechdrs,
> const char *strtab,
>  
>  		/* Format: .klp.sym.sym_objname.sym_name,sympos */
>  		cnt = sscanf(strtab + sym->st_name,
> -			     ".klp.sym.%55[^.].%511[^,],%lu",
> +			     KLP_SYM_PREFIX "%55[^.].%511[^,],%lu",
>  			     sym_objname, sym_name, &sympos);
>  		if (cnt != 3) {
>  			pr_err("symbol %s has an incorrectly
> formatted name\n",
> @@ -305,7 +306,7 @@ static int klp_write_section_relocs(struct module
> *pmod, Elf_Shdr *sechdrs,
>  	 * See comment in klp_resolve_symbols() for an explanation
>  	 * of the selected field width value.
>  	 */
> -	cnt = sscanf(shstrtab + sec->sh_name, ".klp.rela.%55[^.]",
> +	cnt = sscanf(shstrtab + sec->sh_name, KLP_RELA_PREFIX
> "%55[^.]",
>  		     sec_objname);
>  	if (cnt != 1) {
>  		pr_err("section %s has an incorrectly formatted
> name\n",


  parent reply	other threads:[~2024-01-10 13:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 16:25 [PATCH v1 0/5] livepatch: klp-convert tool - Minimal version Lukas Hruska
2023-11-06 16:25 ` [PATCH v1 1/5] livepatch: Create and include UAPI headers Lukas Hruska
2024-01-05 10:15   ` Petr Mladek
2024-01-10 13:38   ` Marcos Paulo de Souza [this message]
2023-11-06 16:25 ` [PATCH v1 2/5] livepatch: Add klp-convert tool Lukas Hruska
2024-01-05 13:29   ` Petr Mladek
2024-01-10 19:03     ` Marcos Paulo de Souza
2024-01-05 15:01   ` Petr Mladek
2023-11-06 16:25 ` [PATCH v1 3/5] kbuild/modpost: integrate klp-convert Lukas Hruska
2024-01-05 14:03   ` Petr Mladek
2024-01-10 19:37   ` Marcos Paulo de Souza
2024-01-25  9:44   ` Lukas Hruska
2023-11-06 16:25 ` [PATCH v1 4/5] livepatch: Add sample livepatch module Lukas Hruska
2024-01-05 14:14   ` Petr Mladek
2023-11-06 16:25 ` [PATCH v1 5/5] documentation: Update on livepatch elf format Lukas Hruska
2024-01-05 14:16   ` Petr Mladek
2024-01-10 19:54   ` Marcos Paulo de Souza
2024-04-10 15:32 ` [PATCH v1 0/5] livepatch: klp-convert tool - Minimal version Marcos Paulo de Souza
2024-04-11  6:27   ` Miroslav Benes
2024-04-11 13:58     ` Lukas Hruska

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=96578fb7568a8c2a318c850e6979bbf8f58cc249.camel@suse.com \
    --to=mpdesouza@suse.com \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=lhruska@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.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

all inboxes | Powered by JetHome®