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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90FC3C61DA4 for ; Fri, 3 Feb 2023 16:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9TvYwF4MsDdsayVYxIl8YwZyPn7RdWJCmTElUPyLVEw=; b=ol8tI2ACcVOUCr rpn7jYfWzvbOULBleBQ9ECW+KSchf7duqrNDmKdKrXyvZzeeIkHq+Z36eVP6rrmVUig8lg5Dp1c9q Kj/Ti/zlPfbmqbKXcjnRieuSo0Mvx4US7rqtN9dIKhkZRiH3KBxkfDaDdqbOi74tBZ55VS1k0bGh0 rNMvHjqmPJhLfYvwWa0yDTitJmf1IFHMJd+JZ4zg6BP+ZO0JEVBAbz5HClBIfCuJ/RRkVats2tN70 BInTo1HPb75/B4m9VqLDUOF1ksxB/TQz+WyPfzcggfN9w/V1yo2aPbljWfCpbhnvu2Buh6i5i5f6G 9+CnDn3EbO4MNzzoLmtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNz2t-002wx7-TG; Fri, 03 Feb 2023 16:36:16 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNz2m-002wt5-MI for linux-arm-kernel@lists.infradead.org; Fri, 03 Feb 2023 16:36:10 +0000 Received: by mail-pj1-x1032.google.com with SMTP id v6-20020a17090ad58600b00229eec90a7fso8497773pju.0 for ; Fri, 03 Feb 2023 08:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=LZtc3hBezsFJ+JgXERdSrjKYkX6f+8fQELANbScmeYk=; b=mHrlZ7VUo1d79tXgLzaqxxG9hcdPrsDjmdvruc68JlP/BcPGX6egmlSPG7P7It0txU 9dSU8O56fxinEmwWStz23VSXfaZYMa0GH4lpLKS7aLvcF5ojWn1K1ZD/aInbbKE8BbJ1 hWhhJvJq4ELKM69xRklBE4mzVGrmH5qINRT1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LZtc3hBezsFJ+JgXERdSrjKYkX6f+8fQELANbScmeYk=; b=OAdquI9Ey4CFGhImTN0uiYJdtCP9fjNu2d/L4CQQ6ALe7Ud1jUCSwaamh1TeWMvhOe 0Oh3FCt4ouu2dN9xY3wfGLuflMP4QsdhuMzmrF9+qHGCDeuUFhVv+NTqbxXNBZjVKqpb KP1HiEzRfMsRWamnSXSFelnMMjnIR1B/EYhHQGKcsAo16SeB8sAST4sgD5P6mqKTrGw7 90xM0cz+rwy8igxl6zPnJw2AbPukI8XITZnq6hgPQzStr0J6jKB2p6FhaMBN0bIROepq Jj2m9RlZxmPfMk4UbZWQrVi3bO3dIVPyB0toCulBjy2/ejTGS4OU2BO8/8mGKkx/tGJ4 4XBw== X-Gm-Message-State: AO0yUKWvCnPZ4upEr7YUCganx1O7fP9mqlvmLVb5xFTZS3+fCuvQjzt9 VQnV9fyne6P/1I8xpPoGrOa6KQ== X-Google-Smtp-Source: AK7set+3gOK3BkJ0vQrBWtI5HAPi2PUYKNh8e6pqdOUt0vJfLvEQUgDgdUfKrw4YniHqw5Fg1TUcIg== X-Received: by 2002:a17:90b:38c2:b0:22c:15a4:62a0 with SMTP id nn2-20020a17090b38c200b0022c15a462a0mr10965335pjb.37.1675442165363; Fri, 03 Feb 2023 08:36:05 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id gt21-20020a17090af2d500b0022c25153cf0sm1405689pjb.44.2023.02.03.08.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 08:36:04 -0800 (PST) Message-ID: <63dd37f4.170a0220.9621b.27b3@mx.google.com> X-Google-Original-Message-ID: <202302031632.@keescook> Date: Fri, 3 Feb 2023 16:36:04 +0000 From: Kees Cook To: Ard Biesheuvel Cc: Catalin Marinas , Will Deacon , Mark Rutland , John Stultz , Yongqin Liu , Sami Tolvanen , Yury Norov , Andrey Konovalov , Marco Elver , linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Nathan Chancellor , Nick Desaulniers , Tom Rix , Alexander Potapenko , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] arm64: Support Clang UBSAN trap codes for better reporting References: <20230202223653.never.473-kees@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230203_083608_778038_38B18AFA X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 03, 2023 at 12:34:38PM +0100, Ard Biesheuvel wrote: > [...] > > + switch (check_type) { > > + case ubsan_add_overflow: > > + return "UBSAN: addition overflow"; > > It would be nice if we could avoid duplicating this UBSAN: prefix 21x times. Yeah, agreed. I didn't see a way around it without weirdness or loss of details. die() takes a string not a format string, so without really odd shenanigans (re-write a single string in memory?) this is the most straight forward. One idea, though, is to drop all the strings that'll never happen -- i.e. wrap individual case statements in the associated CONFIG_UBSAN_foo. I already dropped several strings that were never implemented in the kernel's UBSAN. I could be even more picky. I'll try this in v2... -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel