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]
Message-Id: <20181020131911.22443-2-paul.walmsley@sifive.com>
Date:   Sat, 20 Oct 2018 06:19:12 -0700
From:   Paul Walmsley <paul.walmsley@...ive.com>
To:     linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Cc:     Paul Walmsley <paul.walmsley@...ive.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        Jim Wilson <jimw@...ive.com>, Paul Walmsley <paul@...an.com>
Subject: [PATCH 1/2] modpost: add switch to skip symbol exclusions likely to generate false positives

modpost uses symbol name whitelist patterns to determine whether
symbols should be excluded from section mismatch tests.  Since ELF
local symbols, empty symbol names, and ARM toolchain "magic" symbols
have autogenerated symbol names, they can trigger false positive
warnings for section mismatches, and are thus excluded from the
modpost section mismatch scan.  However, it seems useful to have the
option to include these autogenerated symbols in some section mismatch
scans, as an indicator that a patch set could require more attention
during review.  To that end, this patch adds a '-P' flag to modpost
that disables the filters that exclude autogenerated and empty symbol
names.

Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: Michal Marek <michal.lkml@...kovi.net>
Cc: Jim Wilson <jimw@...ive.com>
Cc: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Paul Walmsley <paul.walmsley@...ive.com>
Signed-off-by: Paul Walmsley <paul@...an.com>
---
 scripts/mod/modpost.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0d998c54564d..38fc1bd47926 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -39,6 +39,8 @@ static int sec_mismatch_verbose = 1;
 static int sec_mismatch_fatal = 0;
 /* ignore missing files */
 static int ignore_missing_files;
+/* accept checks which are more likely to generate false positives if set to 1 */
+static int accept_falsepos_risk;
 
 enum export {
 	export_plain,      export_unused,     export_gpl,
@@ -1292,7 +1294,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
 		symsec = sec_name(elf, get_secindex(elf, sym));
 		if (strcmp(symsec, sec) != 0)
 			continue;
-		if (!is_valid_name(elf, sym))
+		if (!accept_falsepos_risk && !is_valid_name(elf, sym))
 			continue;
 		if (sym->st_value <= addr) {
 			if ((addr - sym->st_value) < distance) {
@@ -2416,7 +2418,7 @@ int main(int argc, char **argv)
 	struct ext_sym_list *extsym_iter;
 	struct ext_sym_list *extsym_start = NULL;
 
-	while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
+	while ((opt = getopt(argc, argv, "i:I:e:mnPsST:o:awM:K:E")) != -1) {
 		switch (opt) {
 		case 'i':
 			kernel_read = optarg;
@@ -2442,6 +2444,9 @@ int main(int argc, char **argv)
 		case 'o':
 			dump_write = optarg;
 			break;
+		case 'P':
+			accept_falsepos_risk = 1;
+			break;
 		case 'a':
 			all_versions = 1;
 			break;
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ