Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp419487pxu; Thu, 7 Jan 2021 08:14:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxv3MrII7iU8lzBeIOG7On25WTo7RpAGH5OUXw7CDjYO3c97UJC31LXRoTtncJniwbz+MFg X-Received: by 2002:a17:906:a29a:: with SMTP id i26mr6738370ejz.45.1610036045484; Thu, 07 Jan 2021 08:14:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610036045; cv=none; d=google.com; s=arc-20160816; b=QB6yhkFE6X6lURxkBByVhUg6QseRFs5ZIb2Kre5RwmUF/PdkPbn26jdsWmh0D+lZDL imwgI2CrfcITdozZ4UsYDjUURJNLtiHbIovEnmfQ3iQpww4DPJcYRECkp133b9u4pK3F VSvyd9m13UqIcVRL4aYdmIIAOaG3BzhXtzkhXn3AbuHFzoWTLuDcZJ3otHwIzWpTX4Ad VYJv4K/+N6hahNSLOYqMvPDthUI8NqCiRONztI9/HnCdT+kcsHCM4aeNkgxEFPeoUqDl /spXnAcRDNnvqRUdz4ycxIuSsHGSxUeFMYF62TQn7hdj/dS6DzR+IFY6QKs5wJ5hkh4i ZoCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wPVdGR/lZMIPZtmDFZMD7E+xGtjKXqmBMijrDSqUod4=; b=Xzd/76z+pXcwBq56+o0xQ6Pql5WO44cqWnp0yVZxnmKmHiOHRPsj+AUZwkEKhcB+6x GzWyKIX+TClBiEzUlvDbTEH1m1SGJP0dLUFJ4PjCdaURj2no3EAYTuFv7Ky/Gmgdt+w8 cu7HBlpR8pWbspGb7LnySH5cbqsPidjjxjU5J9ehXpfrxciL7divniyGvc/MLKU/LKnP XXc1Wo6t3xfcKMknblR82F2kPkXTemF2joj3BukZ5Qd6OB85wdbeGinJgVDD1G7swLhJ ByhYS1fZyTnkGBLO3rhGXchPVxS33Mi2avBb24BEbhMmWTq5GTxyXwvNNqcxmI1i9f35 3KnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aXgpa2fI; 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 a1si2289149ejk.634.2021.01.07.08.13.41; Thu, 07 Jan 2021 08:14:05 -0800 (PST) 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=aXgpa2fI; 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 S1728292AbhAGQK5 (ORCPT + 99 others); Thu, 7 Jan 2021 11:10:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:39788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728246AbhAGQK5 (ORCPT ); Thu, 7 Jan 2021 11:10:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 515C123433 for ; Thu, 7 Jan 2021 16:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610035816; bh=vapd4O3zO+WFwOHRjONF5NNNhlVJffBZwsqWNIoaipg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aXgpa2fI9I9KmOzQNA+drIIhpRXmu1N7lB7Jy9H365Yof5/Y15u2SCET+q78z6Sl6 PvS0Mj6hI5pmuZDteIBJy38VU/OdbdyMaftLTDWILpWMjdL1T/xloY8lHNfzSOt8Fk 9vIQr7AJQXmGWZktas9CGqZlE1hlKmsdqe8ipSqJg7RksMOelfa80CJxYF2GrHs4df cYfiXIH/79ich68rsTa6NTNu11W/AJz8K8Kr2oOGbrplYKSAo9owOekIPD6i+5kycz 9zo/ydAG0HxB2efxzpYSmOmZoX6CQpBhgGkDp6vkVIWkC1x7qaofiWI0w6Ojm2cCTG Z9SaDxW6hB+OQ== Received: by mail-ot1-f51.google.com with SMTP id b24so6793496otj.0 for ; Thu, 07 Jan 2021 08:10:16 -0800 (PST) X-Gm-Message-State: AOAM532dxEAlb4PckkYItoHz2tJZOw3gmZIis1SUe8g42VXOShrhomn9 iSnHOtE45RjFM6bq5LnaoXObW9N33JhBYgK9yUI= X-Received: by 2002:a9d:7a4b:: with SMTP id z11mr7058883otm.305.1610035815622; Thu, 07 Jan 2021 08:10:15 -0800 (PST) MIME-Version: 1.0 References: <20201230154749.746641-1-arnd@kernel.org> <202101061350.913E1FDF6@keescook> In-Reply-To: From: Arnd Bergmann Date: Thu, 7 Jan 2021 17:09:59 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ubsan: disable unsigned-integer-overflow sanitizer with clang To: Kees Cook Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Andrew Morton , Marco Elver , George Popescu , Stephen Rothwell , "linux-kernel@vger.kernel.org" , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 6, 2021 at 11:12 PM Arnd Bergmann wrote: > > On Wed, Jan 6, 2021 at 10:57 PM Kees Cook wrote: > > On Wed, Dec 30, 2020 at 04:47:35PM +0100, Arnd Bergmann wrote: > > > diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan > > > index 8b635fd75fe4..e23873282ba7 100644 > > > --- a/lib/Kconfig.ubsan > > > +++ b/lib/Kconfig.ubsan > > > @@ -122,6 +122,8 @@ config UBSAN_SIGNED_OVERFLOW > > > > > > config UBSAN_UNSIGNED_OVERFLOW > > > bool "Perform checking for unsigned arithmetic overflow" > > > + # clang hugely expands stack usage with -fsanitize=object-size > > > + depends on !CC_IS_CLANG > > > depends on $(cc-option,-fsanitize=unsigned-integer-overflow) > > > > Because of Clang implementation issues (see commit c637693b20da), this is > > already "default n" (and not supported under GCC at all). IIUC, setting > > this to "depends on !COMPILE_TEST" won't work for randconfigs, yes? > > Ah, I had not realized this is clang specific. Adding the !COMPILE_TEST > dependency would hide it for me, which may be good enough for me. > > > Is there some better way to mark this as "known to have issues, please > > don't include in randconfig?" > > > > I'd like to keep it around so people can continue to work out the > > problems with it, but not have unexpecting folks trip over it. ;) > > I've reverted that patch locally now and default-enabled for randconfigs. > Now that I have an otherwise clean build, this should provide me > with a full set of files that produce the warning. If the number is > small enough, I could try opening individual github issues. A day's worth of randconfig builds with clang-11 or clang-12 shows these instances that exceeded the warning limit: crypto/blake2b_generic.c:98:13: error: stack frame size of 9636 bytes in function 'blake2b_compress' [-Werror,-Wframe-larger-than=] crypto/sha512_generic.c:151:13: error: stack frame size of 1292 bytes in function 'sha512_generic_block_fn' [-Werror,-Wframe-larger-than=] lib/crypto/curve25519-fiat32.c:312:22: error: stack frame size of 2180 bytes in function 'fe_mul_impl' [-Werror,-Wframe-larger-than=] lib/crypto/curve25519-fiat32.c:444:22: error: stack frame size of 1588 bytes in function 'fe_sqr_impl' [-Werror,-Wframe-larger-than=] fs/btrfs/scrub.c:3028:31: error: stack frame size of 1132 bytes in function 'scrub_stripe' [-Werror,-Wframe-larger-than=] drivers/net/ethernet/intel/e1000/e1000_main.c:3590:6: warning: stack frame size of 1100 bytes in function 'e1000_update_stats' [-Wframe-larger-than=] drivers/net/ethernet/broadcom/tg3.c:11829:13: warning: stack frame size of 1188 bytes in function 'tg3_get_estats' [-Wframe-larger-than=] drivers/net/ethernet/intel/igb/igb_main.c:6551:6: warning: stack frame size of 1348 bytes in function 'igb_update_stats' [-Wframe-larger-than=] drivers/net/ethernet/intel/igc/igc_main.c:3608:6: warning: stack frame size of 1124 bytes in function 'igc_update_stats' [-Wframe-larger-than=] drivers/net/ethernet/qlogic/qed/qed_l2.c:1759:1: warning: stack frame size of 1300 bytes in function '__qed_get_vport_port_stats' [-Wframe-larger-than=] drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:7022:6: warning: stack frame size of 1564 bytes in function 'ixgbe_update_stats' [-Wframe-larger-than=] drivers/net/ethernet/intel/ixgb/ixgb_main.c:1590:1: warning: stack frame size of 1140 bytes in function 'ixgb_update_stats' [-Wframe-larger-than=] drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c:145:6: warning: stack frame size of 1068 bytes in function 'mlx5i_get_stats' [-Wframe-larger-than=] drivers/staging/media/atomisp/pci/atomisp_cmd.c:5600:5: warning: stack frame size of 1052 bytes in function 'atomisp_set_fmt' [-Wframe-larger-than=] All of these *only* happen on 32-bit x86, and can be reproduced in a i386_defconfig, with the corresponding drivers (btrfs, sha512, blake2b, curve25519, and the ethernet ones) and UBSAN_UNSIGNED_OVERFLOW manually enabled. Given that few people still care about i386, maybe we could just make the option depend on !CONFIG_X86_32 That config also runs into two more BUILD_BUG_ON() that I had not seen in randconfig tests: (i386 defconfig plus ubsan) ld.lld: error: undefined symbol: __compiletime_assert_207 >>> referenced by cpu_entry_area.c >>> mm/cpu_entry_area.o:(setup_cpu_entry_area_ptes) in archive arch/x86/built-in.a (x86-64 defconfig plus ubsan) ld.lld: error: undefined symbol: __compiletime_assert_362 >>> referenced by efi_64.c >>> platform/efi/efi_64.o:(efi_sync_low_kernel_mappings) in archive arch/x86/built-in.a Arnd