Re: [PATCH v2 1/3] kasan: use separate (un)poison implementation for integrated init
From: Peter Collingbourne <hidden>
Date: 2021-05-12 20:08:37
Also in:
linux-mm
On Wed, May 12, 2021 at 5:10 AM Catalin Marinas [off-list ref] wrote:
On Tue, May 11, 2021 at 04:54:24PM -0700, Peter Collingbourne wrote:quoted
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index b1678a61e6a7..e35fa301d3db 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h[...]quoted
@@ -113,8 +113,30 @@ static inline bool kasan_has_integrated_init(void) return false; } +static __always_inline void kasan_alloc_pages(struct page *page, + unsigned int order, gfp_t flags) +{ + /* Only available for integrated init. */ + BUG(); +} + +static __always_inline void kasan_free_pages(struct page *page, + unsigned int order) +{ + /* Only available for integrated init. */ + BUG(); +}Would these two work as BUILD_BUG()?
It looks like it. This creates a dependency on the compiler being powerful enough to optimize away "if (0) undefined_function();" after inlining, which I'm not really a big fan of, but it looks like we're already doing similar things elsewhere in the kernel, so we might as well do it here as well. Peter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel