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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Dec 2021 14:58:38 -0800
From:   David Vernet <void@...ifault.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
Cc:     pmladek@...e.com, linux-doc@...r.kernel.org,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
        jikos@...nel.org, mbenes@...e.cz, joe.lawrence@...hat.com,
        corbet@....net, yhs@...com, songliubraving@...com
Subject: Re: [PATCH] livepatch: Fix leak on klp_init_patch_early failure path

Josh Poimboeuf <jpoimboe@...hat.com> wrote on Mon [2021-Dec-13 12:10:22 -0800]:
> The patch description needs a few tweaks.  In the kernel we don't use
> Markdown for patch descriptions.
> 
> A function can be postfixed with a trailing pair of parentheses, like
> klp_enable_patch().
> 
> Other symbols can be enclosed with single quotes, like 'struct
> klp_object'.
> 
> I'd also recommend avoiding the excessive use of "we", in favor of more
> imperative-type language.
> 
> See Documentation/process/submitting-patches.rst for more details.  It's
> also a good idea to look at some kernel commit logs to get a general
> idea of the kernel patch description style.

Understood, I'll take a read through and re-submit the patch to honor the
norms for Linux kernel patches. My sincere apologies for the noise, and
thank you for the positive and constructive suggestions.

> I don't think the fix will be quite that simple.  For example, if
> klp_init_patch_early() fails, that means try_module_get() hasn't been
> done, so klp_free_patch_finish() will wrongly do a module_put().

Ugh, good point and thank you for catching that. Another problem with the
current patch is that we'll call kobject_put() on the patch even if we
never call kobject_init on the patch due to patch->objs being NULL.

Perhaps we should pull try_module_get() and the NULL check for patch->objs
out of klp_init_patch_early()? It feels a bit more intuitive to me if
klp_init_patch_early() were only be responsible for initializing kobjects
for the patch and its objects / funcs anyways.

Testing it locally seems to work fine. Let me know if this sounds
reasonable to you, and I'll send out a v2 patch with the fixes to both the
patch description, and logic.

- David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ