From patchwork Fri Jan 5 09:40:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 123482 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp589276qgn; Fri, 5 Jan 2018 01:41:26 -0800 (PST) X-Google-Smtp-Source: ACJfBouy5aWPGgos4CxtLkB6kxyc4/NqSXQRIKHKcBMONlWAq+x+1DORfwVy6DP3p1N33w715qvJ X-Received: by 10.159.218.1 with SMTP id v1mr2483669plp.399.1515145286691; Fri, 05 Jan 2018 01:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515145286; cv=none; d=google.com; s=arc-20160816; b=XxMDcSawdh4ikesBUulOnZXeYN80XMVzB8JEacfX9Lm0KNzBxydbaEM2D1logZISam 9YNP5RTCN9ALN9+UpH3Zhg6/ASmmWBcx1Kct/5A51xphMRwbLFEBZW9Q0r3YjsRXYKfw vCZiWrQMoHANVqJXJOBhegTvrNBA28UKdIWkjHvwoc3XupZlEoWIrmROVkc4KQWfrd1F b+0HO1PDJ0hJ4ZYhHOcq+GbUbOLFA/hEnowZAJyy1WGYgx+FMJR2XteQutXH//TIIlj2 MMLxSznh1cMNLPH7Ufn/gaTEyPlUO11Rz5cNDdulhH2zN4W5iOWdvpAOZFcKQ7JCalne oKyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6O1CadamR8eUzxcVS15CfXVBaD0G4bp/hbh8d46vnRI=; b=ZXIULVqXCPhPhcAJ78Cub0+w5b41KhDzRZQS5G1sX/fbNIozs1lXgEkkDfBz1zW+P+ ZKO9ar4F3c1CApENsnJE3dnXTyiTwNsjgwIFoqAff5Mk+ViQlEHK/LJJawsyTPlnB7d6 5TvkPY8mrFP3EdljH5s4xilVM8bca45JfLMOFvNXOc4jSyrxmOhiZrMdpOlC0Toa1i/N 6vKNMRaFRUwvDHERkb/LpzO3okC4naq6re2tbxVnrEGwHWj+mk8NNsTHMexn9RV3caKS mn7Ly4AwJ6XL9HVEphT6PJDU2BW9KA1DbbTIUk/1Pa7cD8LoO93jfmm32/2ZNEEI4i+b heZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h69si3830223pfk.114.2018.01.05.01.41.26; Fri, 05 Jan 2018 01:41:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751457AbeAEJlY (ORCPT + 24 others); Fri, 5 Jan 2018 04:41:24 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:63615 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbeAEJlV (ORCPT ); Fri, 5 Jan 2018 04:41:21 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MGzMw-1ek6483rlK-00Do41; Fri, 05 Jan 2018 10:41:15 +0100 From: Arnd Bergmann To: Andrew Morton , Andrey Ryabinin Cc: Arnd Bergmann , Alexander Potapenko , Dmitry Vyukov , Stephen Rothwell , Andrey Konovalov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] kasan: add declarations for internal functions Date: Fri, 5 Jan 2018 10:40:41 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jQWa04ugA6koipJqzWqWfXO Yjs7MCkvll2vJRpzOUIRThTtPqPwFO5YymVb+g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A patch got merged that made newly added functions static, leading to a warning about unused functions as well as a link error when they are actually used: mm/kasan/kasan.c:780:7: error: '__asan_set_shadow_f8' defined but not used [-Werror=unused-function] mm/kasan/kasan.c:791:8: note: in expansion of macro 'DEFINE_ASAN_SET_SHADOW' mm/kasan/kasan.c:780:7: error: '__asan_set_shadow_f5' defined but not used [-Werror=unused-function] It turns out the underlying problem is that a lot of the internal interfaces of the kasan implementation are only ever called from code generated by the compiler. These don't need any declarations to work fine, but cause warnings both with sparse and with 'make W=1': mm/kasan/kasan.c:695:1: warning: symbol '__asan_load1' was not declared. Should it be static? mm/kasan/kasan.c:695:1: warning: symbol '__asan_store1' was not declared. Should it be static? mm/kasan/kasan.c:696:1: warning: symbol '__asan_load2' was not declared. Should it be static? mm/kasan/kasan.c:696:1: warning: symbol '__asan_store2' was not declared. Should it be static? mm/kasan/kasan.c:697:1: warning: symbol '__asan_load4' was not declared. Should it be static? This removes the bogus 'static' annotation and adds declarations for all affected interfaces. Fixes: mmotm ("kasan: __asan_set_shadow_00 can be static") Signed-off-by: Arnd Bergmann --- mm/kasan/kasan.c | 12 ++++++------ mm/kasan/kasan.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) -- 2.9.0 Acked-by: Dmitry Vyukov diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 83a11e7e3700..3fb497d4fbf8 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c @@ -783,12 +783,12 @@ EXPORT_SYMBOL(__asan_allocas_unpoison); } \ EXPORT_SYMBOL(__asan_set_shadow_##byte) -static DEFINE_ASAN_SET_SHADOW(00); -static DEFINE_ASAN_SET_SHADOW(f1); -static DEFINE_ASAN_SET_SHADOW(f2); -static DEFINE_ASAN_SET_SHADOW(f3); -static DEFINE_ASAN_SET_SHADOW(f5); -static DEFINE_ASAN_SET_SHADOW(f8); +DEFINE_ASAN_SET_SHADOW(00); +DEFINE_ASAN_SET_SHADOW(f1); +DEFINE_ASAN_SET_SHADOW(f2); +DEFINE_ASAN_SET_SHADOW(f3); +DEFINE_ASAN_SET_SHADOW(f5); +DEFINE_ASAN_SET_SHADOW(f8); #ifdef CONFIG_MEMORY_HOTPLUG static int __meminit kasan_mem_notifier(struct notifier_block *nb, diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 2792de927fcd..c12dcfde2ebd 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -120,4 +120,48 @@ static inline void quarantine_reduce(void) { } static inline void quarantine_remove_cache(struct kmem_cache *cache) { } #endif +/* + * Exported functions for interfaces called from assembly or from generated + * code. Declarations here to avoid warning about missing declarations. + */ +asmlinkage void kasan_unpoison_task_stack_below(const void *watermark); +void __asan_register_globals(struct kasan_global *globals, size_t size); +void __asan_unregister_globals(struct kasan_global *globals, size_t size); +void __asan_loadN(unsigned long addr, size_t size); +void __asan_storeN(unsigned long addr, size_t size); +void __asan_handle_no_return(void); +void __asan_poison_stack_memory(const void *addr, size_t size); +void __asan_unpoison_stack_memory(const void *addr, size_t size); +void __asan_alloca_poison(unsigned long addr, size_t size); +void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom); + +void __asan_load1(unsigned long addr); +void __asan_store1(unsigned long addr); +void __asan_load2(unsigned long addr); +void __asan_store2(unsigned long addr); +void __asan_load4(unsigned long addr); +void __asan_store4(unsigned long addr); +void __asan_load8(unsigned long addr); +void __asan_store8(unsigned long addr); +void __asan_load16(unsigned long addr); +void __asan_store16(unsigned long addr); + +void __asan_load1_noabort(unsigned long addr); +void __asan_store1_noabort(unsigned long addr); +void __asan_load2_noabort(unsigned long addr); +void __asan_store2_noabort(unsigned long addr); +void __asan_load4_noabort(unsigned long addr); +void __asan_store4_noabort(unsigned long addr); +void __asan_load8_noabort(unsigned long addr); +void __asan_store8_noabort(unsigned long addr); +void __asan_load16_noabort(unsigned long addr); +void __asan_store16_noabort(unsigned long addr); + +void __asan_set_shadow_00(const void *addr, size_t size); +void __asan_set_shadow_f1(const void *addr, size_t size); +void __asan_set_shadow_f2(const void *addr, size_t size); +void __asan_set_shadow_f3(const void *addr, size_t size); +void __asan_set_shadow_f5(const void *addr, size_t size); +void __asan_set_shadow_f8(const void *addr, size_t size); + #endif