Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp754417rdb; Fri, 2 Feb 2024 03:07:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoEUqORS85PmiZtMNxcwwf9jtyVDO3GQKUwl+02RlbUMqGqBqg1RFMXU+22jbe2RJlKvwL X-Received: by 2002:a05:6358:7e11:b0:176:2852:3ac1 with SMTP id o17-20020a0563587e1100b0017628523ac1mr1561583rwm.28.1706872026025; Fri, 02 Feb 2024 03:07:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706872025; cv=pass; d=google.com; s=arc-20160816; b=n1mYbxRAidco8aTIa9lE2LRiPu6l9ZFfLBZ/OGBz0o6xnI4iqxCfXjmc4r9ZRK35X1 kTVX1s9NKiv4gDmVcsLhjBJi8zMNVl8/YIGWSn+NRglbbim29bccE6PYalu8aWKdExVj F4+EIATm8MqteNuglkZs15Vs3JzYdczEpVv7dXmA6LJWdcx1ubJYnocEfvEOKK1TwD2o ehEI8/5YYc+q21S0s1+WGvlLEOR9QHZBeYBv5To5fFazPvWVpeQynRnGY7UQRnW+AoSD Fp4+LUbyl2IkhltRhQo468ggn2/w3Bc+5rVQ9Rkpr2bhjDU3GC9iP7xPlHsoEWriJFoZ zWww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id; bh=joYXouvAGzsJGc9z7uV8Dj273UDJKIbkxbLuq1H5SaI=; fh=Getdx41fQelPs2lS+s1qQkfOAE8fjNqowF+NVNqlIgM=; b=Pc62C5KhFeBopF3sw6Mld7rVGb7e2xdcI6Mcbhi2JCnfAanC8dlwmW1eTGT87pxtnv ceus7HFJpy2U6owdml0r5nCa1Yc3FUnMWzFwFZwzjqzx88WnloWwjRdLvCIHEPWl2Hf6 jDdoNRr5u/XE4/8NOf1/u2A6fHA+e9CWhqUGzycdJMGHJfoXs+i+okU0hpVCHEQ0BhM6 1HhWOQFZwnrOkxcCZvE+8nme67kFxWw2l4Lkf0kpgSgqtljIQtXHHmcxMowCmOzccRJr ZMu1/y1NtPf6wHDVum7I6pI0Gu4paqmRPKMOaRRY3FktIepH0J+C3H35cmnCm6ONFbIk WSCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zedat.fu-berlin.de); spf=pass (google.com: domain of linux-kernel+bounces-49729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49729-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX5TkYwXKY36goq4N58Ur9AT9Ij0G2sFsL++j9ddWH2UYt+zxpWmQsiZYu6QEXkEQH1I2JPpWpC85RBI/bSlZkymUQFHoiTm91k67YIag== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k19-20020a63ff13000000b005d8b6a66b33si1378015pgi.459.2024.02.02.03.07.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 03:07:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zedat.fu-berlin.de); spf=pass (google.com: domain of linux-kernel+bounces-49729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49729-linux.lists.archive=gmail.com@vger.kernel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7C555283ADB for ; Fri, 2 Feb 2024 11:06:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAFF37A70A; Fri, 2 Feb 2024 11:06:43 +0000 (UTC) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC0893CF41; Fri, 2 Feb 2024 11:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=130.133.4.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706872003; cv=none; b=LEv6FhqHmiGcR+P8aTCT0Qk09WdKTedL3AZwnztEUC928nyRliCJDdFZVUS964S4QBTlfUplJxlkHserI5oTGSeVPcvzwWUftfv37WXd7R0ejDMc+ZLTpm3Z6BmrRfy6aZ8nKSckwXwNEanFEkVPuAPnWLZ9YE+bZUcJ9dgLDAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706872003; c=relaxed/simple; bh=CWY1KewRrcDzL4IL+GfzSLoZDzO1t9oWLwAOkVeq6RQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qiEI6EqnA8UsYE1DRoRhi0tCnukBluuuxZEBq+K8fF5Uk11BEDKXJu5apm78jP6vGQw9HOybVo4qJc4cRORCiL4T+okGGaRWONzLD8t05w2bsy1SKL716HflJXfH+5MuZ3SHCFYDx+Suk+P3LhvXA4t0Cpl8s+Lm4ZWnmal+Sc8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=physik.fu-berlin.de; spf=pass smtp.mailfrom=zedat.fu-berlin.de; arc=none smtp.client-ip=130.133.4.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=physik.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zedat.fu-berlin.de Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.97) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1rVrNK-0000000365V-2lNu; Fri, 02 Feb 2024 12:06:26 +0100 Received: from ip-185-104-138-54.ptr.icomera.net ([185.104.138.54] helo=[172.18.187.1]) by inpost2.zedat.fu-berlin.de (Exim 4.97) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1rVrNK-00000001k1T-1DEY; Fri, 02 Feb 2024 12:06:26 +0100 Message-ID: <9fda57fc1b1ba6ad9bd6f7df3fb12674d0f4f940.camel@physik.fu-berlin.de> Subject: Re: [PATCH] sh: Fix build with CONFIG_UBSAN=y From: John Paul Adrian Glaubitz To: Kees Cook Cc: Yoshinori Sato , kernel test robot , Rich Felker , Masahiro Yamada , Nicolas Schier , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Date: Fri, 02 Feb 2024 12:06:22 +0100 In-Reply-To: <202402020228.BBEF7DAC@keescook> References: <20240130232717.work.088-kees@kernel.org> <494586ed5a0871cf7cfd005f513577952306a0bc.camel@physik.fu-berlin.de> <202402020228.BBEF7DAC@keescook> Autocrypt: addr=glaubitz@physik.fu-berlin.de; prefer-encrypt=mutual; keydata=mQINBE3JE9wBEADMrYGNfz3oz6XLw9XcWvuIxIlPWoTyw9BxTicfGAv0d87wngs9U+d52t/REggPePf34gb7/k8FBY1IgyxnZEB5NxUb1WtW0M3GUxpPx6gBZqOm7SK1ZW3oSORw+T7Aezl3Zq4Nr4Nptqx7fnLpXfRDs5iYO/GX8WuL8fkGS/gIXtxKewd0LkTlb6jq9KKq8qn8/BN5YEKqJlM7jsENyA5PIe2npN3MjEg6p+qFrmrzJRuFjjdf5vv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NIPtqDzid1s8aDLJsPLWlJnfUyMP2ydlTtR54oiVBlFwqqHoPIaJrwTkND5lgFiMIwup3+giLiDOBILtiOSpYxBfSJkz3GGacOb4Xcj8AXV1tpUo1dxAKpJ1ro0YHLJvOJ8nLiZyJsCabUePNRFprbh+srI+WIUVRm0D33bI1VEH2XUXZBL+AmfdKXbHAYtZ0anKgDbcwvlkBcHpA85NpRqjUQ4OerPqtCrWLHDpEwGUBlaQ//AGix+L9c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Original-Sender: glaubitz@physik.fu-berlin.de X-ZEDAT-Hint: PO 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, > >=20 > > On Wed, 2024-01-31 at 12:03 +0100, John Paul Adrian Glaubitz wrote: > > > Hi Kees, > > >=20 > > > 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. > > > >=20 > > > > sh4-linux-ld: arch/sh/boot/compressed/misc.o: in function `zlib_i= nflate_table': > > > > misc.c:(.text+0x670): undefined reference to `__ubsan_handle_shif= t_out_of_bounds' > > > >=20 > > > > Reported-by: kernel test robot > > > > Closes: https://lore.kernel.org/oe-kbuild-all/202401310416.s8HLiLnC= -lkp@intel.com/ > > > > Cc: Yoshinori Sato > > > > Cc: Rich Felker > > > > Cc: John Paul Adrian Glaubitz > > > > Cc: Masahiro Yamada > > > > Cc: Nicolas Schier > > > > Cc: linux-sh@vger.kernel.org > > > > Signed-off-by: Kees Cook > > > > --- > > > > arch/sh/boot/compressed/Makefile | 1 + > > > > 1 file changed, 1 insertion(+) > > > >=20 > > > > diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compre= ssed/Makefile > > > > index b5e29f99c02c..6c6c791a1d06 100644 > > > > --- a/arch/sh/boot/compressed/Makefile > > > > +++ b/arch/sh/boot/compressed/Makefile > > > > @@ -12,6 +12,7 @@ targets :=3D vmlinux vmlinux.bin vmlinux.bin.gz v= mlinux.bin.bz2 \ > > > > vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJEC= TS) > > > > =20 > > > > GCOV_PROFILE :=3D n > > > > +UBSAN_SANITIZE :=3D n > > > > =20 > > > > # > > > > # IMAGE_OFFSET is the load offset of the compression loader > > >=20 > > > Thanks for the patch. I'm looking into this now and will provide the = review later. > >=20 > > I tried to reproduce the error using your tree and the branch devel/ove= rflow/ubsan-only > > minus the above patch and using the provided config but I'm unable to r= eproduce the > > error above. > >=20 > > Am I missing anything? >=20 > 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-lk= p@intel.com/config > (which is notably enabling CONFIG_UBSAN=3Dy and CONFIG_UBSAN_SHIFT=3Dy) t= hen I > see at the final link stage: >=20 > /usr/bin/sh4-linux-gnu-ld: arch/sh/boot/compressed/misc.o: in function `z= lib_inflate_table': > misc.c:(.text+0x650): undefined reference to `__ubsan_handle_shift_out_of= _bounds' > ... >=20 > 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 --=20 .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913