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-next>] [day] [month] [year] [list]
Date:   Tue, 21 Mar 2017 09:30:05 -0700
From:   "John 'Warthog9' Hawley (VMware)" <warthog9@...lescrag.net>
To:     linux-kernel@...r.kernel.org
Cc:     Joe Perches <joe@...ches.com>, Andy Whitcroft <apw@...onical.com>,
        "Darren Hart (VMware)" <dvhart@...radead.org>,
        "John 'Warthog9' Hawley (VMware)" <warthog9@...lescrag.net>
Subject: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings

Spamassassin sticks a long (~79 character) long string after a
line that has a single space in it. The line with space causes
checkpatch to erroniously think that it's in the content body, as
opposed to headers and thus flag a mail header as an unwrapped long
comment line.

This flags when X-Spam-Report is found, till an e-mail
body indicator (blank line, /^[/n/r]*/) is found, blocking setting
$in_commit_log.  When found, unsets itself allowing the rest of
the detection to function normally.

Reported-by: Darren Hart (VMware) <dvhart@...radead.org>
Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@...lescrag.net>
---
 scripts/checkpatch.pl | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index baa3c7b..d2ce89a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2134,6 +2134,7 @@ sub process {
 	my $signoff = 0;
 	my $is_patch = 0;
 	my $in_header_lines = $file ? 0 : 1;
+	my $found_spam_header = 0;
 	my $in_commit_log = 0;		#Scanning lines before patch
 	my $has_commit_log = 0;		#Encountered lines before patch
 	my $commit_log_possible_stack_dump = 0;
@@ -2279,6 +2280,12 @@ sub process {
 
 		my $rawline = $rawlines[$linenr - 1];
 
+#if we encounter a spamassassin mail header, mark it
+		if ($in_header_lines == 1 && $line =~ /^X-Spam-Report:/) {
+			#mail header found, this needs to be flagged
+			$found_spam_header = 1;
+		}
+
 #extract the line range in the file after the patch is applied
 		if (!$in_commit_log &&
 		    $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
@@ -2627,9 +2634,15 @@ sub process {
 
 # Check if it's the start of a commit log
 # (not a header line and we haven't seen the patch filename)
+		if ($in_header_lines && $found_spam_header && $line =~ /^[\n\r]*$/) {
+			# we are now past the header info that could be confusing
+			$found_spam_header = 0;
+		}
+
 		if ($in_header_lines && $realfile =~ /^$/ &&
 		    !($rawline =~ /^\s+\S/ ||
-		      $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
+		      $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i) &&
+		    !$found_spam_header) {
 			$in_header_lines = 0;
 			$in_commit_log = 1;
 			$has_commit_log = 1;
-- 
2.5.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ