From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v2 02/10] netfilter: Avoid assigning 'const' pointer to non-const pointer Date: Fri, 24 Jan 2020 23:00:08 +0100 Message-ID: <20200124220008.GS11457@worktop.programming.kicks-ass.net> References: <20200123153341.19947-1-will@kernel.org> <20200123153341.19947-3-will@kernel.org> <20200124082443.GY14914@hirez.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Nick Desaulniers , Will Deacon , LKML , linux-arch , kernel-team , Michael Ellerman , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann , Peter Oberparleiter , Masahiro Yamada , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" List-Id: linux-arch.vger.kernel.org On Fri, Jan 24, 2020 at 09:36:54AM -0800, Linus Torvalds wrote: > On Fri, Jan 24, 2020 at 12:25 AM Peter Zijlstra wrote: > > > > Just for curiosity's sake. What does clang actually do in that case? > > This shouldn't necessarily be clang-specific. If the variable itself > is 'const', it might go into a read-only section. So trying to modify > it will quite possibly hit a SIGSEGV in user space (and in kernel > space cause an oops). Quite; but I worried clang would use the UB to omit the access entirely, and therefore rob us of the well deserved crash or something. Let me go read Nick's email tho, see what it actually does. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:48208 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgAXWAZ (ORCPT ); Fri, 24 Jan 2020 17:00:25 -0500 Date: Fri, 24 Jan 2020 23:00:08 +0100 From: Peter Zijlstra Subject: Re: [PATCH v2 02/10] netfilter: Avoid assigning 'const' pointer to non-const pointer Message-ID: <20200124220008.GS11457@worktop.programming.kicks-ass.net> References: <20200123153341.19947-1-will@kernel.org> <20200123153341.19947-3-will@kernel.org> <20200124082443.GY14914@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: Nick Desaulniers , Will Deacon , LKML , linux-arch , kernel-team , Michael Ellerman , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann , Peter Oberparleiter , Masahiro Yamada , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" Message-ID: <20200124220008.XJpLQIcybtqIy7maQe_BRggqnJ3IRJ3KmF0bVLajtJQ@z> On Fri, Jan 24, 2020 at 09:36:54AM -0800, Linus Torvalds wrote: > On Fri, Jan 24, 2020 at 12:25 AM Peter Zijlstra wrote: > > > > Just for curiosity's sake. What does clang actually do in that case? > > This shouldn't necessarily be clang-specific. If the variable itself > is 'const', it might go into a read-only section. So trying to modify > it will quite possibly hit a SIGSEGV in user space (and in kernel > space cause an oops). Quite; but I worried clang would use the UB to omit the access entirely, and therefore rob us of the well deserved crash or something. Let me go read Nick's email tho, see what it actually does.