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: <20210514201808.GO975577@paulmck-ThinkPad-P17-Gen-1>
Date:   Fri, 14 May 2021 13:18:08 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     Arnd Bergmann <arnd@...nel.org>, Marco Elver <elver@...gle.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Dmitry Vyukov <dvyukov@...gle.com>, kasan-dev@...glegroups.com,
        linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] kcsan: fix debugfs initcall return type

On Fri, May 14, 2021 at 01:11:05PM -0700, Nathan Chancellor wrote:
> Hi Paul,
> 
> On 5/14/2021 12:36 PM, Paul E. McKenney wrote:
> > On Fri, May 14, 2021 at 11:29:18AM -0700, Nathan Chancellor wrote:
> > > On 5/14/2021 7:00 AM, Arnd Bergmann wrote:
> > > > From: Arnd Bergmann <arnd@...db.de>
> > > > 
> > > > clang points out that an initcall funciton should return an 'int':
> > > > 
> > > > kernel/kcsan/debugfs.c:274:15: error: returning 'void' from a function with incompatible result type 'int'
> > > > late_initcall(kcsan_debugfs_init);
> > > > ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
> > > > include/linux/init.h:292:46: note: expanded from macro 'late_initcall'
> > > >    #define late_initcall(fn)               __define_initcall(fn, 7)
> > > > 
> > > > Fixes: e36299efe7d7 ("kcsan, debugfs: Move debugfs file creation out of early init")
> > > > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > > 
> > > For the record, this requires CONFIG_LTO_CLANG to be visible.
> > > 
> > > Reviewed-by: Nathan Chancellor <nathan@...nel.org>
> > 
> > Queued with the three Reviewed-by tags, thank you all!
> > 
> > Nathan, I lost the thread on exactly what it is that requires that
> > CONFIG_LTO_CLANG be visible.  A naive reader might conclude that the
> > compiler diagnostic does not appear unless CONFIG_LTO_CLANG=y, but
> > that would be surprising (and yes, I have been surprised many times).
> > If you are suggesting that the commit log be upgraded, could you please
> > supply suggested wording?
> 
> You can see my response to Marco here:
> 
> https://lore.kernel.org/r/ad7fa126-f371-5a24-1d80-27fe8f655b05@kernel.org/
> 
> Maybe some improved wording might look like
> 
> clang with CONFIG_LTO_CLANG points out that an initcall function should
> return an 'int' due to the changes made to the initcall macros in commit
> 3578ad11f3fb ("init: lto: fix PREL32 relocations"):

OK, so the naive reading was correct, thank you!

> ...
> 
> Arnd, do you have any objections?

In the meantime, here is what I have.  Please let me know of any needed
updates.

							Thanx, Paul

------------------------------------------------------------------------

commit fe1f4e1b099797d06bd8c66681eed4024c3cad67
Author: Arnd Bergmann <arnd@...db.de>
Date:   Fri May 14 16:00:08 2021 +0200

    kcsan: Fix debugfs initcall return type
    
    clang with CONFIG_LTO_CLANG points out that an initcall function should
    return an 'int' due to the changes made to the initcall macros in commit
    3578ad11f3fb ("init: lto: fix PREL32 relocations"):
    
    kernel/kcsan/debugfs.c:274:15: error: returning 'void' from a function with incompatible result type 'int'
    late_initcall(kcsan_debugfs_init);
    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    include/linux/init.h:292:46: note: expanded from macro 'late_initcall'
     #define late_initcall(fn)               __define_initcall(fn, 7)
    
    Fixes: e36299efe7d7 ("kcsan, debugfs: Move debugfs file creation out of early init")
    Cc: stable <stable@...r.kernel.org>
    Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
    Reviewed-by: Marco Elver <elver@...gle.com>
    Reviewed-by: Nathan Chancellor <nathan@...nel.org>
    Signed-off-by: Arnd Bergmann <arnd@...db.de>
    Signed-off-by: Paul E. McKenney <paulmck@...nel.org>

diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
index c1dd02f3be8b..e65de172ccf7 100644
--- a/kernel/kcsan/debugfs.c
+++ b/kernel/kcsan/debugfs.c
@@ -266,9 +266,10 @@ static const struct file_operations debugfs_ops =
 	.release = single_release
 };
 
-static void __init kcsan_debugfs_init(void)
+static int __init kcsan_debugfs_init(void)
 {
 	debugfs_create_file("kcsan", 0644, NULL, NULL, &debugfs_ops);
+	return 0;
 }
 
 late_initcall(kcsan_debugfs_init);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ