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:   Fri, 20 Nov 2020 13:58:30 +0100
From:   Jessica Yu <jeyu@...nel.org>
To:     Andrii Nakryiko <andrii@...nel.org>
Cc:     bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...com,
        daniel@...earbox.net, kernel-team@...com,
        Bruce Allan <bruce.w.allan@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH bpf-next 2/2] bpf: sanitize BTF data pointer after module
 is loaded

+++ Andrii Nakryiko [19/11/20 10:26 -0800]:
>Given .BTF section is not allocatable, it will get trimmed after module is
>loaded. BPF system handles that properly by creating an independent copy of
>data. But prevent any accidental misused by resetting the pointer to BTF data.
>
>Suggested-by: Jessica Yu <jeyu@...nel.org>
>Fixes: 36e68442d1af ("bpf: Load and verify kernel module BTFs")
>Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>Signed-off-by: Andrii Nakryiko <andrii@...nel.org>

Thanks, Andrii!

Acked-by: Jessica Yu <jeyu@...nel.org>

>---
> kernel/module.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/kernel/module.c b/kernel/module.c
>index f2996b02ab2e..18f259d61d14 100644
>--- a/kernel/module.c
>+++ b/kernel/module.c
>@@ -3709,6 +3709,11 @@ static noinline int do_init_module(struct module *mod)
> 	mod->init_layout.ro_size = 0;
> 	mod->init_layout.ro_after_init_size = 0;
> 	mod->init_layout.text_size = 0;
>+#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
>+	/* .BTF is not SHF_ALLOC and will get removed, so sanitize pointer */
>+	mod->btf_data = NULL;
>+	mod->btf_data_size = 0;
>+#endif
> 	/*
> 	 * We want to free module_init, but be aware that kallsyms may be
> 	 * walking this with preempt disabled.  In all the failure paths, we
>-- 
>2.24.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ