lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 18 Mar 2019 15:21:13 -0400
From:   Joe Lawrence <joe.lawrence@...hat.com>
To:     Joao Moreira <jmoreira@...e.de>
Cc:     live-patching@...r.kernel.org, mbenes@...e.cz, pmladek@...e.cz,
        jikos@...e.cz, nstange@...e.de, jpoimboe@...hat.com,
        khlebnikov@...dex-team.ru, jeyu@...nel.org, matz@...e.de,
        linux-kernel@...r.kernel.org, yamada.masahiro@...ionext.com,
        linux-kbuild@...r.kernel.org, michal.lkml@...kovi.net
Subject: Re: [PATCH v2 7/8] livepatch: Add sample livepatch module

On Fri, Mar 01, 2019 at 11:13:12AM -0300, Joao Moreira wrote:
> From: Josh Poimboeuf <jpoimboe@...hat.com>
> 
> Add a new livepatch sample in samples/livepatch/ to make use of
> symbols that must be post-processed to enable load-time relocation
> resolution. As the new sample is to be used as an example, it is
> annotated with KLP_MODULE_RELOC and with KLP_SYMPOS macros.
> 
> The livepatch sample updates the function cmdline_proc_show to
> print the string referenced by the symbol saved_command_line
> appended by the string "livepatch=1".
> 
> Update livepatch-sample.c to remove livepatch MODULE_INFO
> statement.
> 
> [jmoreira:
> * update module to use KLP_SYMPOS
> * Comments on symbol resolution scheme
> * Update Makefile
> * Remove MODULE_INFO statement
> * Changelog
> ]
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> Signed-off-by: Joao Moreira <jmoreira@...e.de>
> ---
>  samples/livepatch/Makefile                     |   2 +
>  samples/livepatch/livepatch-annotated-sample.c | 113 +++++++++++++++++++++++++
>  2 files changed, 115 insertions(+)
>  create mode 100644 samples/livepatch/livepatch-annotated-sample.c
> 
> [ ... snip ... ]
>
> diff --git a/samples/livepatch/livepatch-annotated-sample.c b/samples/livepatch/livepatch-annotated-sample.c
> new file mode 100644
> index 000000000000..44d9e9542db1
> --- /dev/null
> +++ b/samples/livepatch/livepatch-annotated-sample.c

Super small nit, but I shuffled the annotated-sample code around so it
better matched the original sample.  This minimized the diff when I
compared the two versions to see what was added for sympos annotation:

  [squash] livepatch: adjust annotated sample formatting 
  https://github.com/torvalds/linux/commit/ce49c70e85cf87e513de3bcf64953de191c3c6d7

> [ ... snip ... ]
>
> +static int livepatch_init(void)
> +{
> +	int ret;
> +
> +	ret = klp_register_patch(&patch);
> +	if (ret)
> +		return ret;
> +	ret = klp_enable_patch(&patch);
> +	if (ret) {
> +		WARN_ON(klp_unregister_patch(&patch));
> +		return ret;
> +	}
> +	return 0;
> +}
> +
> +static void livepatch_exit(void)
> +{
> +	WARN_ON(klp_unregister_patch(&patch));
> +}

v5.0 deprecates klp_register_patch(), klp_unregister_patch(), and
klp_disable_patch(), so adjust the sample accordingly:

  [squash] livepatch: rebase the annotated sample 
  https://github.com/torvalds/linux/commit/fc04952376cfd8281eb663bd2ce18fec27eb42b2

-- Joe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ