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] [day] [month] [year] [list]
Message-ID: <1408701977.22832.53.camel@joe-AO725>
Date:	Fri, 22 Aug 2014 03:06:17 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andy Lutomirski <luto@...capital.net>
Cc:	"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>,
	Andy Whitcroft <apw@...onical.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch.pl: New instances of ENOSYS are errors

On Thu, 2014-08-21 at 23:13 -0500, Andy Lutomirski wrote:
> ENOSYS means that a nonexistent system call was called.  We have a
> bad habit of using it for things like invalid operations on
> otherwise valid syscalls.  We should avoid this in new code.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -2372,6 +2372,15 @@ sub process {
>  			     "Using $1 is unnecessary\n" . $herecurr);
>  		}
>  
> +# ENOSYS means "bad syscall nr" and nothing else
> +# (note that this doesn't run on assembly files, so entry*.S is okay)
> +		if ($line =~ /ENOSYS/) {
> +			my $herevet = "$here\n" . cat_vet($line) . "\n";
> +			ERROR("ENOSYS",
> +			      "ENOSYS means 'invalid syscall nr' and nothing else\n" .
> +			      "       (ignore if this really is syscall entry code)\n" . $herevet);
> +		}
> +

It seems this would be noisy.

ENOSYS seems to be used for a lot of other purposes
than syscalls.

Maybe this comment should be changed to clarify:

include/uapi/asm-generic/errno.h:#define        ENOSYS          38      /* Function not implemented */

And this should probably be:

		if ($line =~ /\bENOSYS\b/) {

The $herevet should be $herecurr

And this should be moved after line 2902 so that
it doesn't emit on patch context lines like:

$ git diff drivers/acpi/apei/erst.c
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index ed65e9c..acccc07 100644--git a
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -771,6 +771,7 @@ static int __erst_write_to_nvram(const struct cper_record_header *record)
 static int __erst_read_to_erange_from_nvram(u64 record_id, u64 *offset)
 {
        pr_unimpl_nvram();
+
        return -ENOSYS;
 }
 
$ git diff drivers/acpi/apei/erst.c | ./scripts/checkpatch.pl -
ERROR: ENOSYS means 'invalid syscall nr' and nothing else
       (ignore if this really is syscall entry code)
#10: FILE: drivers/acpi/apei/erst.c:775:
 ^Ireturn -ENOSYS;$


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ