Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5660928rwb; Tue, 22 Nov 2022 03:15:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf55MH1JnDhPx0Aj/M/1S/0Aj+k8Al6Gp3pxrK8gatUqbFfNJRnrCt4oxM6ULdIftdYkmT2u X-Received: by 2002:a17:906:c259:b0:7b5:9670:ae0 with SMTP id bl25-20020a170906c25900b007b596700ae0mr4410220ejb.321.1669115714168; Tue, 22 Nov 2022 03:15:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669115714; cv=pass; d=google.com; s=arc-20160816; b=pAy1b+HEEdy+SP70nIx0XLNDYnVWAnnApaP+SsSUEeSbtWLX0B7KKKKsSzP6VadhDh 3jo6S/RJgZsKxf6RAJkwcFzRk5RLhDCpy6A1pQB4WEBjoowt2Iz8mF2Zw30Cn0xectbg 6p6884zQQAi5B1rI4cndlslCsAy3AOPzhLAyy0AUf7rX9e918dPPZPQck9k5cfoN0Css ZrCEFS+fQ1hxK+5/In8d4rUE1Lh+shcPwIaxcMrRhhHkIkmbw3dscbvnsyR+XJwBvUYy P6qgCyWlHMBCeeIyj9VoZPrzWGTrc7XQUeNwACkI3iAGB4Mqm6d7IEgbgf2e4sfOny3q jQqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qiPhbkwAI/xsCItHsFRuVip1BIcjDwn1WOh9E0WKWWA=; b=n9rpGV8H/hq/0bQY+uUatMyKgobs6m/H7i8ejBS4PKXWKs4TEYwTaOfK50kgYaJNHA OK1h+reHnf5DU4sUtRVLA7q1rZ77KPFFwg3lkp8TRjtjWTX/sG9ywUOT9VdwvdIOb3iY 2kDorJFugwijLIPBgrUrBegIHszhf3ePPKaVSg27u6oG3/J+QUOslVQiR0VPNyygH/az U5u5DaR68jpdYFVKfGo1DdwIUOPkeEal1+g/YmXt45OQVk+6dHxmwN9VySmiNipOHa4o Qjl8DLZWAG6LFLN7YPp818ltfZGmbUJmGtPBgCvrH3/zsS8MLBx5jzdk358n3xQXFCXI glww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gotplt.org header.s=dreamhost header.b=wJxTewb1; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a17090658cc00b007ae0ea72153si14179941ejs.696.2022.11.22.03.14.51; Tue, 22 Nov 2022 03:15:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gotplt.org header.s=dreamhost header.b=wJxTewb1; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232773AbiKVKWM (ORCPT + 91 others); Tue, 22 Nov 2022 05:22:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbiKVKV2 (ORCPT ); Tue, 22 Nov 2022 05:21:28 -0500 Received: from bee.birch.relay.mailchannels.net (bee.birch.relay.mailchannels.net [23.83.209.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CCEFD7B; Tue, 22 Nov 2022 02:20:42 -0800 (PST) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B42BB3C0F8C; Tue, 22 Nov 2022 10:20:41 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 149133C0A9D; Tue, 22 Nov 2022 10:20:41 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1669112441; a=rsa-sha256; cv=none; b=l991j0ndctJJAKL1CVEFkMOfzSlZbXoH4aEl45t+N1uBz+AoZM1z7jfRm//9LSbSHJvWoF XzFkbnMVzACZm7nHJsFzo9z/zvwFsrlOMDgyseEN7hvNBsuHCKIfGrAAAi5/E26ZA8uE7z PTpuBb4s7yxk9BwUXwibZiDvLZCxRIqXsyfGYumANtU+z0Qn4B/a2yaMOx+gRjFrDrDxDT bQv/OemMdBEFv/s21+cH+nPiPCsCJsy2VSa1KVFO1HSRbLvnPGyfl/sIgUoIqrs+ilMOpU M/Z+JwnslOxXc2wOdKVfHlOChRuMVzD8EgiiWSIgX+uZY5L/9EQUc+EoE4BXdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1669112441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qiPhbkwAI/xsCItHsFRuVip1BIcjDwn1WOh9E0WKWWA=; b=kjTb1EHAOocHKzoSaje4LBfxjDyL6VuYdhVcYqhUDiUKcPKtFDklNTBuvNuBY2Fc6Dd1Ju u17lmk1LjdA3lifCpK34jDej+ASHl6DpkCufC6KiVixeqDOzY0sXmmw8NcS2DmtVZxOme1 adYylYcFjatCWzuWTqnH22zOAkfR215L8ygV++Ho30+4QNpgmRvNOQY9DTVvI4N/qydn3w xCPOjsjk+URGWc7eQng8ZvC0CPBRhLVdhymW0XI1cECjBmLVAxWTZ2ef63MRtQ5r3S8kqw ocyzxqfyCvhM9m8KqtG5cLXyDl5dFXX9sjnu2eWmw1VtRezGl+HC/c2Y2JU7ww== ARC-Authentication-Results: i=1; rspamd-64c57ffbcf-gmhf8; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Vacuous-Robust: 5419300679b2401a_1669112441516_4245864710 X-MC-Loop-Signature: 1669112441516:1950271019 X-MC-Ingress-Time: 1669112441516 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.179.81 (trex/6.7.1); Tue, 22 Nov 2022 10:20:41 +0000 Received: from [192.168.0.182] (bras-base-toroon4834w-grc-23-76-68-24-147.dsl.bell.ca [76.68.24.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4NGgJ71dRvzSB; Tue, 22 Nov 2022 02:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1669112440; bh=qiPhbkwAI/xsCItHsFRuVip1BIcjDwn1WOh9E0WKWWA=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=wJxTewb1A8WOR3hcBGdT/BQJa4rCcOq2EPVtOuauuy4Nn1tL60H1eWIEZt0ztOo9f 6qVD+rx2fNDVRlpaK8+lITQ+H1ZxUdeIvfuS7vtAy9PMaMc4eKK7SXzt/jC3U6oVEp SU2LOHhwikC3m+Qu+9zf8BiCkOkjtZKoYagndAeU4FdapikRsUGEdESeiT4S4iLjrJ uc+6UyEyG+aM5ONt/TM7PO/eK2ZXcff42739Jr0uCyCYnQe+epC8KJcphDPpR2OTZI 5t+/Qd0LlOvaaY21NpGfVH6DRlWVgfOfiaoehn8YZdmObYYuQ7n91xleGrzYENC74/ jpjLBabVpnvrg== Message-ID: <0da67f73-dd73-7e6d-74c2-14aec5d79902@gotplt.org> Date: Tue, 22 Nov 2022 05:20:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 4/4] fortify: Use __builtin_dynamic_object_size() when available Content-Language: en-US To: Kees Cook , linux-hardening@vger.kernel.org Cc: Miguel Ojeda , Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Tom Rix , llvm@lists.linux.dev, Juergen Gross , Boris Ostrovsky , linux-kernel@vger.kernel.org References: <20220920192202.190793-1-keescook@chromium.org> <20220920192202.190793-5-keescook@chromium.org> From: Siddhesh Poyarekar In-Reply-To: <20220920192202.190793-5-keescook@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-09-20 15:22, Kees Cook wrote: > Since the commits starting with c37495d6254c ("slab: add __alloc_size > attributes for better bounds checking"), the compilers have runtime > allocation size hints available in some places. This was immediately > available to CONFIG_UBSAN_BOUNDS, but CONFIG_FORTIFY_SOURCE needed > updating to explicitly make use the hints via the associated > __builtin_dynamic_object_size() helper. Detect and use the builtin when > it is available, increasing the accuracy of the mitigation. When runtime > sizes are not available, __builtin_dynamic_object_size() falls back to > __builtin_object_size(), leaving the existing bounds checking unchanged. > > Additionally update the VMALLOC_LINEAR_OVERFLOW LKDTM test to make the > hint invisible, otherwise the architectural defense is not exercised > (the buffer overflow is detected in the memset() rather than when it > crosses the edge of the allocation). > > Cc: Miguel Ojeda > Cc: Siddhesh Poyarekar > Cc: Arnd Bergmann > Cc: Nick Desaulniers > Cc: Nathan Chancellor > Cc: Tom Rix > Cc: linux-hardening@vger.kernel.org > Cc: llvm@lists.linux.dev > Signed-off-by: Kees Cook > --- > drivers/misc/lkdtm/heap.c | 1 + > include/linux/compiler_attributes.h | 5 +++++ > include/linux/fortify-string.h | 7 +++++++ > 3 files changed, 13 insertions(+) Hi Kees, Circling back on this, I noticed that all but this patch got pulled into Linus' tree. Is there a reason why this has been held back? Thanks, Sid