From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F587C76194 for ; Mon, 22 Jul 2019 12:56:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECF5621921 for ; Mon, 22 Jul 2019 12:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729984AbfGVM4s (ORCPT ); Mon, 22 Jul 2019 08:56:48 -0400 Received: from relay.sw.ru ([185.231.240.75]:43164 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727164AbfGVM4r (ORCPT ); Mon, 22 Jul 2019 08:56:47 -0400 Received: from [172.16.25.12] by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hpXru-00023q-6u; Mon, 22 Jul 2019 15:56:42 +0300 Subject: Re: [PATCH] [v2] ubsan: build ubsan.c more conservatively To: Arnd Bergmann , akpm@linux-foundation.org Cc: Josh Poimboeuf , Peter Zijlstra , stable@vger.kernel.org, Borislav Petkov , Dmitry Vyukov , Thomas Gleixner , Ingo Molnar , Kees Cook , Matthew Wilcox , Ard Biesheuvel , Andy Shevchenko , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <20190722125139.1335385-1-arnd@arndb.de> From: Andrey Ryabinin Message-ID: <96d5c129-3b27-5b0f-f34c-e6d89e7467b2@virtuozzo.com> Date: Mon, 22 Jul 2019 15:56:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190722125139.1335385-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/22/19 3:50 PM, Arnd Bergmann wrote: > objtool points out several conditions that it does not like, depending > on the combination with other configuration options and compiler > variants: > > stack protector: > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0xbf: call to __stack_chk_fail() with UACCESS enabled > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0xbe: call to __stack_chk_fail() with UACCESS enabled > > stackleak plugin: > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled > > kasan: > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x25: call to memcpy() with UACCESS enabled > lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x25: call to memcpy() with UACCESS enabled > > The stackleak and kasan options just need to be disabled for this file > as we do for other files already. For the stack protector, we already > attempt to disable it, but this fails on clang because the check is > mixed with the gcc specific -fno-conserve-stack option. According > to Andrey Ryabinin, that option is not even needed, dropping it here > fixes the stackprotector issue. > > Fixes: d08965a27e84 ("x86/uaccess, ubsan: Fix UBSAN vs. SMAP") > Link: https://lore.kernel.org/lkml/20190617123109.667090-1-arnd@arndb.de/t/ > Link: https://lore.kernel.org/lkml/20190722091050.2188664-1-arnd@arndb.de/t/ > Cc: stable@vger.kernel.org > Signed-off-by: Arnd Bergmann Reviewed-by: Andrey Ryabinin