Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1770649lqp; Mon, 15 Apr 2024 17:46:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvgRLAoC11+x0UygGH9sOB6Opl6dseCTHObTs4lCGF7+c8f23y/jVC2mFmbMT1PvQFhtJVJqagEa6T2JypLh6yBeCAQCB8tP433adlxw== X-Google-Smtp-Source: AGHT+IHwb79INrx7c+4RYQQRqJWgwlQXw2jAdC79bEqj3fipYZufEOUXLL+uBDXqe3ShCeF9ygt8 X-Received: by 2002:a05:620a:408a:b0:78e:df42:518 with SMTP id f10-20020a05620a408a00b0078edf420518mr7598193qko.8.1713228399857; Mon, 15 Apr 2024 17:46:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713228399; cv=pass; d=google.com; s=arc-20160816; b=OEMXgycplvagvH/omdx8JJDnNU7MpLGZSw5pXdSdL/ATiJAgb9emQaUpRn/gHWebkP wgb8oDMalYVrgk9vfEJpTyHomTgAPQpusnbFSuQ/xm3+e3lS/oGd53VIyl9Z/bH48eMM Qa3VeJTA3sLL+9+LzWo0lBwQLTRYKrCW5l9g+hu4+Sz7CVg6FAb42t5E9750wBUf4Gyp C/XoH+2tdXRG6RlzfnjjpaG1zUERraG8dE347AUdsgrdzCRlfXXvsiC7i8HYOg2mkymA Avgu735WikEhx4tIAF0652k39rvVcQDA5v2EvM6A6XQ7+mAtnHmoGk98kJ0v9doB0Ek6 +xVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SarbV9gzd7Ext5uREk+cO+VjFEa4L7Rs/CELnpCJsv8=; fh=JLor4qrUTHxHYRfXHtlfs6qQKJ+lnCU8hQu2Zp4k9oE=; b=Pj1Fd7cnE0tKq8UPV/FDeflEaZ6VIzy+IGBDbikRLyrqbts9eTmcDzjzIUmb3aZO7f RbBFBK6HOGHBJL2jdJRi2d6OK7IWCI5a91HLmCczMrA5d5werkSwRyN/pm9FEPL5ZFxe jJMch3L23tlT9tcZJMIYQ7drtr8kf0MFpvYuTrqOeun9h8x8FUwRt1LcSiHx2mheAGbs gD1/MlM/gVOFC9ANBLxHg3UiKybv2sBP3YmQOhmMReP4FF6nGjJNXZcLqzteB0qb9IWh AOYieVlJ3IXsjbFH3B/udReQm6m76U0nx4Rn3Oc2fSNZunKh9LyHHAVswoAAxqtyoIq6 X/7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P0gwi6j9; 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-146047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bj21-20020a05620a191500b0078d704a8e7esi12779228qkb.490.2024.04.15.17.46.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 17:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P0gwi6j9; 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-146047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146047-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 84FFB1C20F1E for ; Tue, 16 Apr 2024 00:46:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C8AE4C98; Tue, 16 Apr 2024 00:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="P0gwi6j9" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 3CE5D1849 for ; Tue, 16 Apr 2024 00:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713228390; cv=none; b=uyQwhD7d+4oo08H5fx5AUF74JXDCggHoR42k17SNIRyoQE0CCIMppF9Th4woCMO1tZmXJX49HkjU+mZJiYSmTgZW7byI+Vct5vPn0URXStJrmKpJv33VwdeRqI2TrmvvMznGQJp3s/zU1sbZeoSj0d8pelNKCSF6cnvxaceRe5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713228390; c=relaxed/simple; bh=015eEwhLzWafHkc0BsCRogWYfs3SqoEKVTXAAy/Fhf0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pdNGnz3UmRxvRuENG+s+z0IyOF/D62rxjB4waLI82LF70e+RJW5PBzOH0FuaXlnrycGUVT6/XiMsxGd1BWNZrZi2IH74eUNXjx/fubki0RufCfA0w4aq6wNd/coAGjFfDEk+VmyOJLmLczeHyj0nlNCgEgGBF/fMX4Vmm81EAn8= 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=P0gwi6j9; arc=none smtp.client-ip=209.85.214.169 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-pl1-f169.google.com with SMTP id d9443c01a7336-1e51398cc4eso36781665ad.2 for ; Mon, 15 Apr 2024 17:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713228388; x=1713833188; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SarbV9gzd7Ext5uREk+cO+VjFEa4L7Rs/CELnpCJsv8=; b=P0gwi6j9oLI/Dwi5h7eAZTZi3aI00LBxvktANtbgHKKzHAFmz68iLfOWl05rx1bfUA ldfTKzej5CEwBxGW74Sf6f2U2kl01+mMPBmpYzmOQhl9oYWn35vpzvak3m1jaTylVs+c Ceq5Habm015Kj15goXxJKgXLhBfEglQax9Wl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713228388; x=1713833188; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SarbV9gzd7Ext5uREk+cO+VjFEa4L7Rs/CELnpCJsv8=; b=gZYed3egUnDOLXOLgdNCh2/fCzrRpeEDVq9awKWpdw7z3z1mNsvnIGrDQ/Vu6dkGLr 3kmRhjEFLPtNzzi9hJv+6agQQsz2izUtb0TUVvBzRHhd06zPBrsV5Qf8+kkjkrzf6nge /gnOc9YvcjuGzgiQn5OKVoPG4BaE+og1K2ZJha4pQfkmke4uDevvxdU4jmXDR+GiwtST KyP3vdasr6r/0429PoqqU8vKA5dD63joNOQcZcw3I8skpv+O0c64HABTo9To0/eCe6nH HhxIsIxs9LbcFcmk4IPYpvxmjB44X19vXrqJ+9UxnzYIsSLGrXzmUfxwPlgyNc7xjcCH +wtA== X-Forwarded-Encrypted: i=1; AJvYcCUM7voNuHTow4AdfFzz/tVlSoCBQXPVI1ArDS1Z8OV0eqDME7UTiAvEFPpztz3Pu1ZAegOg18g+RHXdU6iGKpoyBlGTq+onz9MLgbNf X-Gm-Message-State: AOJu0YzcBHn4fF0ZLD5mHWnMLGVeIiLwlzVl8XBx5sCJSjzj6C9jXjeH aDdc2fPnTiC3M5kWX2WIowNtuJOv/qAHanHIcRkozT9RON0YvK0kQoZyb0rynw== X-Received: by 2002:a17:902:82c4:b0:1e4:b4f5:5cfa with SMTP id u4-20020a17090282c400b001e4b4f55cfamr11411241plz.27.1713228388653; Mon, 15 Apr 2024 17:46:28 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b001e3d2314f4bsm8688355plb.132.2024.04.15.17.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 17:46:28 -0700 (PDT) Date: Mon, 15 Apr 2024 17:46:27 -0700 From: Kees Cook To: Nathan Chancellor Cc: Marco Elver , Justin Stitt , Andrey Konovalov , Andrey Ryabinin , Andrew Morton , kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org, Nick Desaulniers , Bill Wendling , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] ubsan: Add awareness of signed integer overflow traps Message-ID: <202404151738.AC6F6C210@keescook> References: <20240415182832.work.932-kees@kernel.org> <20240415183454.GB1011455@dev-arch.thelio-3990X> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240415183454.GB1011455@dev-arch.thelio-3990X> On Mon, Apr 15, 2024 at 11:34:54AM -0700, Nathan Chancellor wrote: > On Mon, Apr 15, 2024 at 11:28:35AM -0700, Kees Cook wrote: > > On arm64, UBSAN traps can be decoded from the trap instruction. Add the > > add, sub, and mul overflow trap codes now that CONFIG_UBSAN_SIGNED_WRAP > > exists. Seen under clang 19: > > > > Internal error: UBSAN: unrecognized failure code: 00000000f2005515 [#1] PREEMPT SMP > > > > Reported-by: Nathan Chancellor > > Closes: https://lore.kernel.org/lkml/20240411-fix-ubsan-in-hardening-config-v1-0-e0177c80ffaa@kernel.org > > Fixes: 557f8c582a9b ("ubsan: Reintroduce signed overflow sanitizer") > > Signed-off-by: Kees Cook > > As I mentioned, CONFIG_UBSAN_SIGNED_INTEGER_WRAP needs to be > CONFIG_UBSAN_SIGNED_WRAP. I applied this change with that fix up and the Whoops; thanks! > warning now becomes: > > Internal error: UBSAN: integer subtraction overflow: 00000000f2005515 [#1] PREEMPT SMP Perfecto. :) > So: > > Tested-by: Nathan Chancellor Thanks! -- Kees Cook