Message ID | 20240130232717.work.088-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1559374dyb; Tue, 30 Jan 2024 15:28:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8V6V3w0GZlr+YTnOGrqmtOja43Wcq6Q5mWiLgnmso//kd/stkcfyZe5gp5dr42lLFECTi X-Received: by 2002:a05:6402:35c2:b0:55f:694f:c13e with SMTP id z2-20020a05640235c200b0055f694fc13emr497735edc.25.1706657290921; Tue, 30 Jan 2024 15:28:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706657290; cv=pass; d=google.com; s=arc-20160816; b=B1KkpyO4cENh4p38paEaKP9fgVcA5HBRFnsm+5HZ5ac8K8v+c7B4NKHVaptuYTel+n EJL1grlmF7zuCdhNNfoE3jB1JeicAsw+oH9t8IsDxujtcr9eG1XskDxeOKrAB9Agz8Fh 5lLmbBB6CvdQJsOr27P5rGBfaHImq38Vg8lnDOn1fNLxDGNzDS8HsIrbDwhGUWc3iPL0 ktz0kJS+cEpQQljO49TozPwiJyW30wbCFd5yaBSbeQPXYmzKUKM+0GUEV+6X1kkEYb1K NgLo7CW2mkdXBgQHXf8BqvuSZMR1Er9Wr9MlP5Otgv2XVWWxLjm/umJ0y9j6TKng7YGG uDbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=nTXXsmwzTjPyQq0o9yr9KqNZv5QrGu6RUP3Khobjfp4=; fh=tSPGikM2JjHGnlnjSqmS7BRZP4LL2xbbDmQ6dQ//iwc=; b=cq7FxVcT/C2fpCbtgNrhmlEIwyotRDq0/1H1WQAIEuk+ugNC6VMeeS6TvO78jymoOI UYUacIFobBIl8r83KPFjRqcsxiB4arOlWrZK3H8cOifi7nYQ2TBWpZ6t5/G1/hPX/Tln toQYLmFcT5rhsFnA6f4Jg51qOgFpCua5LrZ4Hg4wvHVzi8KJQ306lciFRu7PBbzIdmmp uuqNoLF8kh/07QGn0K+O/+QDN3B9XII2rYNbrDB3v1TzQPfXfR9RGsp7WupRVxWfUHXP 5MHLkr+JCy2kZyPKJGt577FGMyKj7HpLa1cM7rV0wcDZLhXwLsQXCpOlSx35BN0wMua4 jUTA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ACEWrIRw; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y71-20020a50bb4d000000b0055f85541fb8si17992ede.232.2024.01.30.15.28.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:28:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ACEWrIRw; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45477-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8A7021F2210A for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 23:28:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8EA97F469; Tue, 30 Jan 2024 23:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ACEWrIRw" Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349747995B for <linux-kernel@vger.kernel.org>; Tue, 30 Jan 2024 23:27:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706657247; cv=none; b=YIoy4M8NzoLrjiQhuZWmfqLfIi53TPF3Mz2kMmmDuK3mRb1WMsZdM1k6gxTfFy3BgmAX5dnpYI8plzppvFxYFQtNPcePKllO9+zL3LrQ054tBoPWaL5I2PhRM4+zhwkc+wxNn4EZn9aoAVrl4Xps0NIlW8LMPS5pGGTYrXiHc64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706657247; c=relaxed/simple; bh=sOCwHJ8Q2pYqaViGMIp5ahANU0cmFlFhu0ydQtm2Glk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=OR863OGSjaNezIKvXMSlVeOMJL4jgwe+xblj6Mvuz/aoZ4xIGHxfpj6WIkcBwWKDU8sxSwqjdhZPea1HOIpRl7a4DGyMqbbPfxLJMcLGaeboAz0atzyJJd2l53re1TcF19Ds+HbyllS32YtVgS8Z00P2dOwcvDlpYgGGcysn7Mw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ACEWrIRw; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-5ce6b5e3c4eso2594582a12.2 for <linux-kernel@vger.kernel.org>; Tue, 30 Jan 2024 15:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706657245; x=1707262045; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nTXXsmwzTjPyQq0o9yr9KqNZv5QrGu6RUP3Khobjfp4=; b=ACEWrIRwGv6nXMKTzmkIjh31/SKyfkyTGjGBnuH3/lktt0Tl3GSBGpLDmoBWTpd/bN yK/Hb13sXMN/4c/GWpgQfbKGKGDa2iTSmYb62vS30LhnlyeQXLNpXCKhDyS9eJn8uoti TxIg+52E3x4SjcXv6q2L6KRQTfzZB/+XumgfU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706657245; x=1707262045; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nTXXsmwzTjPyQq0o9yr9KqNZv5QrGu6RUP3Khobjfp4=; b=X14bhDZI/38gPDGMy0VhXJFqU5hN0YlmNGDiL/1YEhDjvAHxC/VREVG2JcRCy4j+Wo BD5fOrLf8YWGzg3i0EmvEtGKzHqfiKPSzelrbCs4+Jpqz3Zv16FqPMIinBbA3T52mgUV erODhhvYx4VJkARzS/dBpaL9WAoarU3QwD536cUDg/eDjm7UHXd8YBGhIkhOXx0QjOhD mEPAqLzFAeXcNkcdFYhrD0nMCwsJyRPk+5y80YAZpQhXAPvjyivSunuQ8+izUqC3UuNC wB3+CCTI1XN4EiV8Yw09nbTy11PTsgvg5e5F/qQuDoAB9oaukE5gXqqmkpNh9nrBMlu6 LXIg== X-Gm-Message-State: AOJu0YzhHFAE70evtQMRato84pcECFcMSovRnxdlwH2ASMF528Bvb99h WWGq6u3xnT5ntQL40YNXYDmrhj/LzQuAV6rkA0pir/B6KhR6bui/0pl1Sle/OQ== X-Received: by 2002:a05:6a20:4d93:b0:19a:508a:7f70 with SMTP id gj19-20020a056a204d9300b0019a508a7f70mr5160379pzb.30.1706657245557; Tue, 30 Jan 2024 15:27:25 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXXjT7jAns/aN2p87T+txOMPmldkeF5dTU38Qoz/OnAQZBVKzp+ZEKsoHBXtNdK8V91h3dl3e0v73W9fr4Iig+Ay1d/qEszLvBbBFPFaerwIgEqYYeZhGB76+WUcGf4jTC5SbQBG2cyIRYNoN64XJwHtqDWSO0x7ZDK3+bGOTfeOYsKKqeIyZPnQi7yIxO1IoerDlshlkFQNJkWVmu5QjLz1hl41VzqLRA3x9hnh/GzcNie2j5f+bs28Ei2Z1+ul9g8hpKywRWIEqBYsAp3SI74Q3h5jL9kXhUUIHpZdZ992XWmG6qqo/HrRkIhNw== Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id b13-20020a170902b60d00b001d75c26e857sm7646222pls.288.2024.01.30.15.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 15:27:25 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Kees Cook <keescook@chromium.org>, kernel test robot <lkp@intel.com>, Rich Felker <dalias@libc.org>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, Masahiro Yamada <masahiroy@kernel.org>, Nicolas Schier <n.schier@avm.de>, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] sh: Fix build with CONFIG_UBSAN=y Date: Tue, 30 Jan 2024 15:27:23 -0800 Message-Id: <20240130232717.work.088-kees@kernel.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1307; i=keescook@chromium.org; h=from:subject:message-id; bh=sOCwHJ8Q2pYqaViGMIp5ahANU0cmFlFhu0ydQtm2Glk=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBluYXbYzMwvQzdjb4LcQVxPeQiFyjaVT+WJc4sp l/6tgT3hKuJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZbmF2wAKCRCJcvTf3G3A JnubEAC1rdcv4mXd5Kmfw9RTR96KqhlOzXKsoSCQanjkimlERYXY9Zbr7+F0nO7Rcy+HL0sN42L HxNNvF1WpJM9Id4eCbxOBP6rPWCXAt+FsD47sETq/ckp9EnQESMOKNIamMkvOfh1gnNU7JMaEMF WJP0uxTKNN+FDY7QBq7khT1XfluHcDmSsBKn6XxS9sfkzb2JOkbGyYZ+eJx7+pP9THs04Pv8jLt GlLswu6HU6Je8vHJlkGH6oNFzjVLjOUVSspo7i0AwOt//pb13qzn3sb1G6TQMK96GJRZgbeEDQK +P9Cu47L3h2il/lpLq43gLCdV9HRCL8dROb8gTH84U+UXMM/7jvTsLrCbWJIC3UUeEAGP/WHHlu W8c8dYNIi8OX9D+63rGA6LHv287P1n3wOcMRxI3tAJIpTNd4THib8DIomIjO9esIEvBGaUnuEm/ Iv6FV0LbnN8Cbhk7YcovFlcr3gg7uz+GX5J6UJUiaPcUj2/P7F4xvVgASCF1cgkCBHJLW4VNEAg R2w8HW7UYVD3JT5hvmVlpzAo13D5SC9Xyd3vFqex7KMcT5QP0Q2e2OL8rS4jrx2p2I/OEvtC6kU TCSal4XF0gQfvR5J+xOtJDdv9vuQUOmIBYFg4SlcZGqYI+bFAMcp8hKhTKVJ4l+naLk8sDL2IAA 0JimCo7 8nxXvC9w== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789559875469164831 X-GMAIL-MSGID: 1789559875469164831 |
Series |
sh: Fix build with CONFIG_UBSAN=y
|
|
Commit Message
Kees Cook
Jan. 30, 2024, 11:27 p.m. UTC
The early boot stub for sh had UBSan instrumentation present where it is
not supported. Disable it for this part of the build.
sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table':
misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds'
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC-lkp@intel.com/
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nicolas Schier <n.schier@avm.de>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
arch/sh/boot/compressed/Makefile | 1 +
1 file changed, 1 insertion(+)
Comments
Hi Kees, On Tue, 2024-01-30 at 15:27 -0800, Kees Cook wrote: > The early boot stub for sh had UBSan instrumentation present where it is > not supported. Disable it for this part of the build. > > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC-lkp@intel.com/ > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > Cc: Rich Felker <dalias@libc.org> > Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> > Cc: Masahiro Yamada <masahiroy@kernel.org> > Cc: Nicolas Schier <n.schier@avm.de> > Cc: linux-sh@vger.kernel.org > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > arch/sh/boot/compressed/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile > index b5e29f99c02c..6c6c791a1d06 100644 > --- a/arch/sh/boot/compressed/Makefile > +++ b/arch/sh/boot/compressed/Makefile > @@ -12,6 +12,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinuxbin.bz2 \ > vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) > > GCOV_PROFILE := n > +UBSAN_SANITIZE := n > > # > # IMAGE_OFFSET is the load offset of the compression loader Thanks for the patch. I'm looking into this now and will provide the review later. Adrian
Hi Kees, On Wed, 2024-01-31 at 12:03 +0100, John Paul Adrian Glaubitz wrote: > Hi Kees, > > On Tue, 2024-01-30 at 15:27 -0800, Kees Cook wrote: > > The early boot stub for sh had UBSan instrumentation present where it is > > not supported. Disable it for this part of the build. > > > > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC-lkp@intel.com/ > > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > > Cc: Rich Felker <dalias@libc.org> > > Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> > > Cc: Masahiro Yamada <masahiroy@kernel.org> > > Cc: Nicolas Schier <n.schier@avm.de> > > Cc: linux-sh@vger.kernel.org > > Signed-off-by: Kees Cook <keescook@chromium.org> > > --- > > arch/sh/boot/compressed/Makefile | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile > > index b5e29f99c02c..6c6c791a1d06 100644 > > --- a/arch/sh/boot/compressed/Makefile > > +++ b/arch/sh/boot/compressed/Makefile > > @@ -12,6 +12,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ > > vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) > > > > GCOV_PROFILE := n > > +UBSAN_SANITIZE := n > > > > # > > # IMAGE_OFFSET is the load offset of the compression loader > > Thanks for the patch. I'm looking into this now and will provide the review later. I tried to reproduce the error using your tree and the branch devel/overflow/ubsan-only minus the above patch and using the provided config but I'm unable to reproduce the error above. Am I missing anything? Thanks, Adrian
On Wed, Jan 31, 2024 at 12:19:22PM +0100, John Paul Adrian Glaubitz wrote: > Hi Kees, > > On Wed, 2024-01-31 at 12:03 +0100, John Paul Adrian Glaubitz wrote: > > Hi Kees, > > > > On Tue, 2024-01-30 at 15:27 -0800, Kees Cook wrote: > > > The early boot stub for sh had UBSan instrumentation present where it is > > > not supported. Disable it for this part of the build. > > > > > > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > > > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > > > > > Reported-by: kernel test robot <lkp@intel.com> > > > Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC-lkp@intel.com/ > > > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > > > Cc: Rich Felker <dalias@libc.org> > > > Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> > > > Cc: Masahiro Yamada <masahiroy@kernel.org> > > > Cc: Nicolas Schier <n.schier@avm.de> > > > Cc: linux-sh@vger.kernel.org > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > > --- > > > arch/sh/boot/compressed/Makefile | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile > > > index b5e29f99c02c..6c6c791a1d06 100644 > > > --- a/arch/sh/boot/compressed/Makefile > > > +++ b/arch/sh/boot/compressed/Makefile > > > @@ -12,6 +12,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ > > > vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) > > > > > > GCOV_PROFILE := n > > > +UBSAN_SANITIZE := n > > > > > > # > > > # IMAGE_OFFSET is the load offset of the compression loader > > > > Thanks for the patch. I'm looking into this now and will provide the review later. > > I tried to reproduce the error using your tree and the branch devel/overflow/ubsan-only > minus the above patch and using the provided config but I'm unable to reproduce the > error above. > > Am I missing anything? When I use GCC 13.2 (I'm specifically on Ubuntu 23.10) and the randconfig linked from the report: https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config (which is notably enabling CONFIG_UBSAN=y and CONFIG_UBSAN_SHIFT=y) then I see at the final link stage: /usr/bin/sh4-linux-gnu-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': misc.c:(.text+0x650): undefined reference to `__ubsan_handle_shift_out_of_bounds' .. After the patch, it's solved. -Kees
Hi Kees, On Fri, 2024-02-02 at 02:32 -0800, Kees Cook wrote: > On Wed, Jan 31, 2024 at 12:19:22PM +0100, John Paul Adrian Glaubitz wrote: > > Hi Kees, > > > > On Wed, 2024-01-31 at 12:03 +0100, John Paul Adrian Glaubitz wrote: > > > Hi Kees, > > > > > > On Tue, 2024-01-30 at 15:27 -0800, Kees Cook wrote: > > > > The early boot stub for sh had UBSan instrumentation present where it is > > > > not supported. Disable it for this part of the build. > > > > > > > > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > > > > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > > > > > > > Reported-by: kernel test robot <lkp@intel.com> > > > > Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC-lkp@intel.com/ > > > > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > > > > Cc: Rich Felker <dalias@libc.org> > > > > Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> > > > > Cc: Masahiro Yamada <masahiroy@kernel.org> > > > > Cc: Nicolas Schier <n.schier@avm.de> > > > > Cc: linux-sh@vger.kernel.org > > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > > > --- > > > > arch/sh/boot/compressed/Makefile | 1 + > > > > 1 file changed, 1 insertion(+) > > > > > > > > diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile > > > > index b5e29f99c02c..6c6c791a1d06 100644 > > > > --- a/arch/sh/boot/compressed/Makefile > > > > +++ b/arch/sh/boot/compressed/Makefile > > > > @@ -12,6 +12,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ > > > > vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) > > > > > > > > GCOV_PROFILE := n > > > > +UBSAN_SANITIZE := n > > > > > > > > # > > > > # IMAGE_OFFSET is the load offset of the compression loader > > > > > > Thanks for the patch. I'm looking into this now and will provide the review later. > > > > I tried to reproduce the error using your tree and the branch devel/overflow/ubsan-only > > minus the above patch and using the provided config but I'm unable to reproduce the > > error above. > > > > Am I missing anything? > > When I use GCC 13.2 (I'm specifically on Ubuntu 23.10) and the randconfig > linked from the report: > https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config > (which is notably enabling CONFIG_UBSAN=y and CONFIG_UBSAN_SHIFT=y) then I > see at the final link stage: > > /usr/bin/sh4-linux-gnu-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > misc.c:(.text+0x650): undefined reference to `__ubsan_handle_shift_out_of_bounds' > ... > > After the patch, it's solved. OK, let me test with gcc 13.x. My build host is currently running openSUSE Leap 15.5. Adrian
Hi Kees, On Fri, 2024-02-02 at 12:06 +0100, John Paul Adrian Glaubitz wrote: > > When I use GCC 13.2 (I'm specifically on Ubuntu 23.10) and the randconfig > > linked from the report: > > https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config > > (which is notably enabling CONFIG_UBSAN=y and CONFIG_UBSAN_SHIFT=y) then I > > see at the final link stage: > > > > /usr/bin/sh4-linux-gnu-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > > misc.c:(.text+0x650): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > ... > > > > After the patch, it's solved. > > OK, let me test with gcc 13.x. My build host is currently running openSUSE Leap 15.5. I just wanted to try reproduce the problem again with the reproducer in [1] as well as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. Can you tell me where to find the patches now? Adrian > [1] https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/reproduce
On Sun, Feb 11, 2024 at 11:39:49AM +0100, John Paul Adrian Glaubitz wrote: > Hi Kees, > > On Fri, 2024-02-02 at 12:06 +0100, John Paul Adrian Glaubitz wrote: > > > When I use GCC 13.2 (I'm specifically on Ubuntu 23.10) and the randconfig > > > linked from the report: > > > https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config > > > (which is notably enabling CONFIG_UBSAN=y and CONFIG_UBSAN_SHIFT=y) then I > > > see at the final link stage: > > > > > > /usr/bin/sh4-linux-gnu-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > > > misc.c:(.text+0x650): undefined reference to `__ubsan_handle_shift_out_of_bounds' > > > ... > > > > > > After the patch, it's solved. > > > > OK, let me test with gcc 13.x. My build host is currently running openSUSE Leap 15.5. > > I just wanted to try reproduce the problem again with the reproducer in [1] as well > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. > > Can you tell me where to find the patches now? Sure, they're in -next, but for an -rc2 based tree, see: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=for-next/kspp
On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > I just wanted to try reproduce the problem again with the reproducer in [1] as well > > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. > > > > Can you tell me where to find the patches now? > > Sure, they're in -next, but for an -rc2 based tree, see: > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=for-next/kspp OK, thanks. I will give it a try with gcc-13. Adrian
Hi Kees, On Mon, 2024-02-12 at 19:45 +0100, John Paul Adrian Glaubitz wrote: > On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > > I just wanted to try reproduce the problem again with the reproducer in [1] as well > > > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. > > > > > > Can you tell me where to find the patches now? > > > > Sure, they're in -next, but for an -rc2 based tree, see: > > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=for-next/kspp > > OK, thanks. I will give it a try with gcc-13. I'm still unable to reproduce the error that the kernel test robot reported. I'm using gcc-13: glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc sh4-linux-gcc: fatal error: no input files compilation terminated. glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc --version sh4-linux-gcc (GCC) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. glaubitz@node54:/data/home/glaubitz/linux-kees> I checked out your tree and the for-next/kspp branch. Then fetched the config that triggered the bug like this: $ wget https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config -O .config Building the kernel with "make -j32 uImage" works fine. No errors except for some unreleated warnings that still need to be fixed. Adrian
Hi Adrian, On Wed, 2024-02-14 at 13:52 +0100, John Paul Adrian Glaubitz wrote: > Hi Kees, > > On Mon, 2024-02-12 at 19:45 +0100, John Paul Adrian Glaubitz wrote: > > On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > > > I just wanted to try reproduce the problem again with the reproducer in [1] as well > > > > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. > > > > > > > > Can you tell me where to find the patches now? > > > > > > Sure, they're in -next, but for an -rc2 based tree, see: > > > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=for-next/kspp > > > > OK, thanks. I will give it a try with gcc-13. > > I'm still unable to reproduce the error that the kernel test robot reported. > > I'm using gcc-13: > > glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc > sh4-linux-gcc: fatal error: no input files > compilation terminated. > glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc --version > sh4-linux-gcc (GCC) 13.2.0 > Copyright (C) 2023 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > glaubitz@node54:/data/home/glaubitz/linux-kees> > > I checked out your tree and the for-next/kspp branch. > > Then fetched the config that triggered the bug like this: > > $ wget https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config -O .config > > Building the kernel with "make -j32 uImage" works fine. No errors except for > some unreleated warnings that still need to be fixed. Sorry for late reply. Seems like the warnings can be reproduced by "make zImage" which is the default make target, but cannot be reproduced by "make uImage". HEAD is now at 918327e9b7ffb ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL $ wget https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config -O .config $ sh4-linux-gcc --version sh4-linux-gcc (GCC) 13.2.0 $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh olddefconfig $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh ... LD arch/sh/boot/compressed/vmlinux sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `inflate_fast': misc.c:(.text+0xc5c): undefined reference to `__ubsan_handle_shift_out_of_bounds' sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflateReset': misc.c:(.text+0xd00): undefined reference to `__ubsan_handle_shift_out_of_bounds' sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate': misc.c:(.text+0x23fc): undefined reference to `__ubsan_handle_shift_out_of_bounds' sh4-linux-ld: arch/sh/boot/compressed/ashldi3.o: in function `__ashldi3': ashldi3.c:(.text+0xc8): undefined reference to `__ubsan_handle_shift_out_of_bounds' make[3]: *** [arch/sh/boot/compressed/Makefile:38: arch/sh/boot/compressed/vmlinux] Error 1 make[2]: *** [arch/sh/boot/Makefile:40: arch/sh/boot/compressed/vmlinux] Error 2 make[1]: *** [arch/sh/Makefile:170: zImage] Error 2 make: *** [Makefile:240: __sub-make] Error 2 $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh uImage ... OBJCOPY arch/sh/boot/vmlinux.bin GZIP arch/sh/boot/vmlinux.bin.gz UIMAGE arch/sh/boot/uImage.gz Image Name: Linux-6.8.0-rc2+ Created: Fri Mar 1 13:31:36 2024 Image Type: SuperH Linux Kernel Image (gzip compressed) Data Size: 9297141 Bytes = 9079.24 KiB = 8.87 MiB Load Address: 08001000 Entry Point: 08002000 Image arch/sh/boot/uImage is ready -- Best Regards, Yujie
Hi Yujie, On Fri, 2024-03-01 at 05:46 +0000, Liu, Yujie wrote: > On Wed, 2024-02-14 at 13:52 +0100, John Paul Adrian Glaubitz wrote: > > Hi Kees, > > > > On Mon, 2024-02-12 at 19:45 +0100, John Paul Adrian Glaubitz wrote: > > > On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > > > > I just wanted to try reproduce the problem again with the reproducer in [1] as well > > > > > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no longer exists. > > > > > > > > > > Can you tell me where to find the patches now? > > > > > > > > Sure, they're in -next, but for an -rc2 based tree, see: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=for-next/kspp > > > > > > OK, thanks. I will give it a try with gcc-13. > > > > I'm still unable to reproduce the error that the kernel test robot reported. > > > > I'm using gcc-13: > > > > glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc > > sh4-linux-gcc: fatal error: no input files > > compilation terminated. > > glaubitz@node54:/data/home/glaubitz/linux-kees> sh4-linux-gcc --version > > sh4-linux-gcc (GCC) 13.2.0 > > Copyright (C) 2023 Free Software Foundation, Inc. > > This is free software; see the source for copying conditions. There is NO > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > > > glaubitz@node54:/data/home/glaubitz/linux-kees> > > > > I checked out your tree and the for-next/kspp branch. > > > > Then fetched the config that triggered the bug like this: > > > > $ wget https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config -O .config > > > > Building the kernel with "make -j32 uImage" works fine. No errors except for > > some unreleated warnings that still need to be fixed. > > Sorry for late reply. Seems like the warnings can be reproduced by > "make zImage" which is the default make target, but cannot be > reproduced by "make uImage". > > HEAD is now at 918327e9b7ffb ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL > > $ wget https://download.01.org/0day-ci/archive/20240131/202401310416.s8HLiLnC-lkp@intel.com/config -O .config > $ sh4-linux-gcc --version > sh4-linux-gcc (GCC) 13.2.0 > > $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh olddefconfig > $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh > ... > LD arch/sh/boot/compressed/vmlinux > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate_table': > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shift_out_of_bounds' > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `inflate_fast': > misc.c:(.text+0xc5c): undefined reference to `__ubsan_handle_shift_out_of_bounds' > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflateReset': > misc.c:(.text+0xd00): undefined reference to `__ubsan_handle_shift_out_of_bounds' > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_inflate': > misc.c:(.text+0x23fc): undefined reference to `__ubsan_handle_shift_out_of_bounds' > sh4-linux-ld: arch/sh/boot/compressed/ashldi3.o: in function `__ashldi3': > ashldi3.c:(.text+0xc8): undefined reference to `__ubsan_handle_shift_out_of_bounds' > make[3]: *** [arch/sh/boot/compressed/Makefile:38: arch/sh/boot/compressed/vmlinux] Error 1 > make[2]: *** [arch/sh/boot/Makefile:40: arch/sh/boot/compressed/vmlinux] Error 2 > make[1]: *** [arch/sh/Makefile:170: zImage] Error 2 > make: *** [Makefile:240: __sub-make] Error 2 > > $ make -j72 CROSS_COMPILE=sh4-linux- ARCH=sh uImage > ... > OBJCOPY arch/sh/boot/vmlinux.bin > GZIP arch/sh/boot/vmlinux.bin.gz > UIMAGE arch/sh/boot/uImage.gz > Image Name: Linux-6.8.0-rc2+ > Created: Fri Mar 1 13:31:36 2024 > Image Type: SuperH Linux Kernel Image (gzip compressed) > Data Size: 9297141 Bytes = 9079.24 KiB = 8.87 MiB > Load Address: 08001000 > Entry Point: 08002000 > Image arch/sh/boot/uImage is ready Thanks a lot for pointing this out. This explains the problem. I will have another look over the weekend and acknowledge the patch if Kees wants to pick it up through his own tree. Adrian
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile index b5e29f99c02c..6c6c791a1d06 100644 --- a/arch/sh/boot/compressed/Makefile +++ b/arch/sh/boot/compressed/Makefile @@ -12,6 +12,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) GCOV_PROFILE := n +UBSAN_SANITIZE := n # # IMAGE_OFFSET is the load offset of the compression loader