Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4401543rwb; Tue, 20 Sep 2022 13:24:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bDN4YqmGqVmi1pMQb/Lz/a8zE4eOtqVvEC7BS+bNo1i4yiYYJsTa8LPIHifWGkSF+iuIE X-Received: by 2002:a17:907:96a2:b0:776:15f3:1ffe with SMTP id hd34-20020a17090796a200b0077615f31ffemr18670760ejc.406.1663705463389; Tue, 20 Sep 2022 13:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663705463; cv=none; d=google.com; s=arc-20160816; b=lO6yD4UhDGzQyDntaBiH8BWxKW8ChMUtWz3SK9NdulwE509ic4kJHX3dIhfhf81ypK Tn96QRfGj+o3KzA7PWnz+WM0nkUiCNVyYin3sOH67fRTvbX3pE+J8Xioc7I5+9vcnep5 XlScM6beGV+X1j7VJ7fOZEeeCCDW7g/Oh0m4t4i7DMQu1y+Vj9q/B77LfyseEqR4BTA0 9ErazWx1AfV2ZhYbJsnG6sd93w3a6/nyUjaHVBUuRqQjZwcvdN0oF3nC9jh/P8FFnR9o GMjZARXkzy5B+MXyEEEKy30o2+bjeUx3cPK97AobX5Bw565pi96/Cr57TE6S8Cje68Is 7AiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y1Vq3TVJb/VWSLfO0Rb19+4XJtG6XYStvEWudetclg0=; b=VLLHQzZZHrPalol4WdA1Pv12UI2OrxYf0m5tjEbtPYJErqV5T+vmfGYTLT8iqvpdjb AnF+/Anv53YZxZSS5NhxK6A/YdPcegTveXcOhw2NzaIRr0W7lMpSEfuhx5UrYcdSHWZT Ome7lp0O1jHLusHIhxFPnFW0vd3XSCq3D5ctJXlftNkUIG7ZKyvd9hvCyDOBXuAeucXy TItIBM+UNMg+gOImYraY8bTMZgTcc0nrSYHbq1vAZ5M4ngT+l5Y/utmZVS4cc1OxaxmN llNAUrQDZ0FefEfff4xsKSWSB15jGEqc8zO3bMn/KquIuB1xwf9qgJPO/8ESQ2QUbJ7U iG3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VfqVLJ45; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a170906475400b0077e6bd32780si528880ejs.779.2022.09.20.13.23.57; Tue, 20 Sep 2022 13:24:23 -0700 (PDT) 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=@chromium.org header.s=google header.b=VfqVLJ45; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbiITTWQ (ORCPT + 99 others); Tue, 20 Sep 2022 15:22:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbiITTWL (ORCPT ); Tue, 20 Sep 2022 15:22:11 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32EF27FE6 for ; Tue, 20 Sep 2022 12:22:10 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id q9-20020a17090a178900b0020265d92ae3so11815406pja.5 for ; Tue, 20 Sep 2022 12:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=Y1Vq3TVJb/VWSLfO0Rb19+4XJtG6XYStvEWudetclg0=; b=VfqVLJ45y647x0gXwo2gQ+z8ehdPiGmN765iLaQZImjK9/W6CfiT4udXBkZJQS5RWi 5YUKsiZRaPGTmFqgMg0S6JrUAb3QT+mxnm8vI0rl1t7Uz1P0at2DCiu6MyDDIRqDVqp5 mkNGp3A0YtuQgcMH37ZLEU/iA03FJATEvCmKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=Y1Vq3TVJb/VWSLfO0Rb19+4XJtG6XYStvEWudetclg0=; b=y7q4cOkpvYA5XNvdFifdHVf75bQg2z8ZTmsJ5id7A3Mxp19d8eeGU/J/IY+s44T1Wy ykQdRw9xDLd/26NqfWOx8fWRyL4oh9nTFNmYpFcn2YT24l9I0O6te0AGj0jqZ/O3xiMH CWelbL8WabXx6CCOFDhqPuE2OSdmWOkytYGJR6mPWC9bA3ZNseyIBcYUj60K5AlHW+Zx 70KosWQNhY+tVACp1M2yz8jxnVFRfUt090IA912P6YVhD3G1UlMURq2izMz0yEGNQWzW ut32Hfha5ymGcocJZS5+e7d8bmP7iORY5I0gAZUbbCevt9YBArbQRIYlicdcp6MwWypE eS+Q== X-Gm-Message-State: ACrzQf2loFmJcEzahe+vVvCS7UOTtYVwTegYRAeHobYDL2IXtyymXYNp JG5jVMTWLlolf06c98L3kG8qig== X-Received: by 2002:a17:902:8307:b0:172:e611:491f with SMTP id bd7-20020a170902830700b00172e611491fmr1079757plb.111.1663701730500; Tue, 20 Sep 2022 12:22:10 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y23-20020aa79af7000000b00536aa488062sm249174pfp.163.2022.09.20.12.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 12:22:08 -0700 (PDT) From: Kees Cook To: linux-hardening@vger.kernel.org Cc: Kees Cook , Siddhesh Poyarekar , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Juergen Gross , Boris Ostrovsky , Tom Rix , Miguel Ojeda , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 0/4] fortify: Use __builtin_dynamic_object_size() when available Date: Tue, 20 Sep 2022 12:21:58 -0700 Message-Id: <20220920192202.190793-1-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=772; h=from:subject; bh=J1jKJHEXW6fuYZp0bwrwLqGsXtJ2fCfxnhbkDPep9j4=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjKhLY5BfaUkXVQJ7vCxL3yWuutd9/BjsHihL3Ygj4 bXMlY6aJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYyoS2AAKCRCJcvTf3G3AJoxoEA CNWvotJduQ1+tj7cnZlwvQosnG4/aa+Tua7+dPMGebxam64/SsgNEoEDE+iYOFec1iIT+TWr8DmBMs EMbqXsh+5rZssPPBiIy/lKv6+nO58viHWBPTOrFOxjJezOdqzX5hdK95NTYC6eyawrsUC7KnHrfVyv 8uBqte82ZYL5hfRgO1u02u8C5Bf6vtyatkJ2a5nZLLcpnur5eQLS1TX6/TsVUqcbNF6RYURASxZYxq lNcTVV+DgbsaId76L8ljOwV7Dz08ykjlIWsJYinvKgJWtHh3Ya/FIg6Fg0wsSnoRpdKL2pEBS+mjw8 scvWa4vMb/CTqwBfYwJRi1l4lScrE/BeIUVBtCu+xcGpc+gp1l4FTKTxoTMk45DT0CXAWU9xxTqc6c gSsZV2A0ZaxVRmLjiXIVZBZyjq6GQ2v89cwHB25GBATaN7EksK82VcoD9hAPrZcOauqYKDNVOXZqcv PpO5iSx1rbRkKKc25kGoYIrCrM5qRXyBEQK/TJcmBLXtaqCGukGx0OBRVuBhi/+PKBc1unOPjp5s39 fBtan6hdZ+J2bxFNBlDxauaECtMUzhFuGY+UDK278LYJq5ucd/NRTst6+Tn32tg7T5c+nM37eKAa/C y46/iBV/2fCPGMCZHrv1f27M6fd0S4sj9JrAy2oCimhN5Gm+bmpFdDiS46lw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi, This adjusts CONFIG_FORTIFY_SOURCE's coverage to include greater runtime size checking from GCC and Clang's __builtin_dynamic_object_size(), which the compilers can track either via code flow or from __alloc_size() hints. Thanks, -Kees Kees Cook (4): x86/entry: Work around Clang __bdos() bug fortify: Explicitly check bounds are compile-time constants fortify: Convert to struct vs member helpers fortify: Use __builtin_dynamic_object_size() when available arch/x86/xen/enlighten_pv.c | 3 +- drivers/misc/lkdtm/heap.c | 1 + include/linux/compiler_attributes.h | 5 ++ include/linux/fortify-string.h | 125 ++++++++++++++++------------ 4 files changed, 81 insertions(+), 53 deletions(-) -- 2.34.1