Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp908377pxj; Fri, 14 May 2021 20:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAuzn3yjEZPagG798HFByrCHVH107XXFKQYVvISEdyDi4ioLR/1pWDcgAYu4rB6rFr+Q93 X-Received: by 2002:aa7:cd46:: with SMTP id v6mr57858228edw.16.1621050273213; Fri, 14 May 2021 20:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621050273; cv=none; d=google.com; s=arc-20160816; b=DDsbU9FmEmN3FFUIoa4Z/oLRjQIuDLfj/RJI3nEiJ/vpGuP3MoyFACgqxtasPtO6xZ QpeQvEWhEXHhIqB/SgxnykitlBkpyBsxtg7q55TBrl3UpJIRVGXawz03kXeRMhdkhE/c 2HjqWpYypOPf06CGwCewjF51Zd5SiFn3Ri1l4noRxZYhEZNOpWe4/Jb2ZdCeO+C8UUdr LGULW6SuAaK/BK6Xqt9DeDyoiw4UV+V0S1A+fsCmEo/D6q8BqbI6P0oP3C4Pi67oQzWW JaVcUqlf/wArg98r0kO8VMtuEJmLe9YOnapLUlQTKqQmUS+kS+/rlbeg8v5DgGGwKX7P AA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=MbMRH9aQGBcpuLiuC5ysrrHyZ2X4NOOtBqxMIQmcVZg=; b=MeEu6ARElVIhLAyDFlZq5ODTF7OOiqQuVve1yziS7D6uYQnU9rEggJ0vwICImBVJUw 7kOWT6BKnvpg7uyUBWEB7apGrLcZc5qlYn5JZk25uNgqV4NhVcxkJ85n6ivkBYatvpKz i8TVSi2jCF8NWR6YZuk/8ewoJUTPPse7+ITX8B2nfAq8g2lfwK5rrAfzDcl3Z1WMUCCu 1iD4wNXiz8KXZbYGIHq+5MlpNTGzPEwzrDCfHtL7yRUPB05SdenrA4l0CfahsrfRj8/r hxpZL9ATTAI4r48QG6PQUhzJ7GVLXEHalRD4mT9EoRNtgyGiV+RQNFGTPViMbWUVEaz2 mnPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vE1zjlua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si7420105edv.5.2021.05.14.20.44.08; Fri, 14 May 2021 20:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vE1zjlua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234635AbhEOA5D (ORCPT + 99 others); Fri, 14 May 2021 20:57:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbhEOA5C (ORCPT ); Fri, 14 May 2021 20:57:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6411B6135C; Sat, 15 May 2021 00:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621040150; bh=EI4xLhzrOMh6Itqyez82lmxWaI98QNTA+23VqjpcLmw=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=vE1zjluaPWy4WN3cRyhehvyD8XsxOBotjrMu9hOuU5YWM9bJD61B5pqQoA01wHlwY v5tgj9ejYg7wakXvPSRvWx5pIE3CM+Pg0ZsNuy95K087j33YjXsPAn8qz6CsnBkX2i HPyT8vxTi+OP8lLnCSJufqVmXLa/Zxfj7wPdwqDrtzA+dXTmGkqbw5R9nYXWrB4xra vkId8Ss3o2CT/p5H9fbEyE/Rm2wIcZWjWn6NkxiZ90yIpXZOBDvN9vXnKQyRmQ4M2T pB6uBuAqLkR9jsjeJ+YtR2YY8kInl0VfYFqJkGzOnXkIY+oCvxsHFsn2fOwVXxwck8 SJ2lSolYGTXyg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 231B25C02A5; Fri, 14 May 2021 17:55:50 -0700 (PDT) Date: Fri, 14 May 2021 17:55:50 -0700 From: "Paul E. McKenney" To: Marco Elver Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Greg Kroah-Hartman , Dmitry Vyukov , kasan-dev , Linux Kernel Mailing List , clang-built-linux Subject: Re: [PATCH] kcsan: fix debugfs initcall return type Message-ID: <20210515005550.GQ975577@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210514140015.2944744-1-arnd@kernel.org> <0ad11966-b286-395e-e9ca-e278de6ef872@kernel.org> <20210514193657.GM975577@paulmck-ThinkPad-P17-Gen-1> <534d9b03-6fb2-627a-399d-36e7127e19ff@kernel.org> <20210514201808.GO975577@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 15, 2021 at 01:01:31AM +0200, Marco Elver wrote: > On Fri, May 14, 2021 at 11:16PM +0200, Arnd Bergmann wrote: > > On Fri, May 14, 2021 at 10:18 PM Paul E. McKenney wrote: > > > On Fri, May 14, 2021 at 01:11:05PM -0700, Nathan Chancellor wrote: > > > > > > 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. > > > > > > > Looks good to me, thanks for the improvements! > > FWIW, this prompted me to see if I can convince the compiler to complain > in all configs. The below is what I came up with and will send once the > fix here has landed. Need to check a few other config+arch combinations > (allyesconfig with gcc on x86_64 is good). Cool! If I have not sent the pull request for Arnd's fix by Wednesday, please remind me. Thanx, Paul > Thanks, > -- Marco > > ------ >8 ------ > > >From 96c1c4e9902e96485268909d5ea8f91b9595e187 Mon Sep 17 00:00:00 2001 > From: Marco Elver > Date: Fri, 14 May 2021 21:08:50 +0200 > Subject: [PATCH] init: verify that function is initcall_t at compile-time > > In the spirit of making it hard to misuse an interface, add a > compile-time assertion in the CONFIG_HAVE_ARCH_PREL32_RELOCATIONS case > to verify the initcall function matches initcall_t, because the inline > asm bypasses any type-checking the compiler would otherwise do. This > will help developers catch incorrect API use in all configurations. > > A recent example of this is: > https://lkml.kernel.org/r/20210514140015.2944744-1-arnd@kernel.org > > Signed-off-by: Marco Elver > Cc: Andrew Morton > Cc: Arnd Bergmann > Cc: Joe Perches > Cc: Masahiro Yamada > Cc: Miguel Ojeda > Cc: Nathan Chancellor > Cc: "Paul E. McKenney" > --- > include/linux/init.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/init.h b/include/linux/init.h > index 045ad1650ed1..d82b4b2e1d25 100644 > --- a/include/linux/init.h > +++ b/include/linux/init.h > @@ -242,7 +242,8 @@ extern bool initcall_debug; > asm(".section \"" __sec "\", \"a\" \n" \ > __stringify(__name) ": \n" \ > ".long " __stringify(__stub) " - . \n" \ > - ".previous \n"); > + ".previous \n"); \ > + static_assert(__same_type(initcall_t, &fn)); > #else > #define ____define_initcall(fn, __unused, __name, __sec) \ > static initcall_t __name __used \ > -- > 2.31.1.751.gd2f1c929bd-goog >