From patchwork Fri Aug 25 15:24:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qing Zhao X-Patchwork-Id: 13729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp1874418vqm; Fri, 25 Aug 2023 08:26:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/wxx1MYidG8GziPJ4JrjHBLk0/DH7nL/r8bnFg3NS4kEcoTMxcrw/Rw9dVadmeAmmWtM8 X-Received: by 2002:aa7:d3d2:0:b0:51b:c714:a2a1 with SMTP id o18-20020aa7d3d2000000b0051bc714a2a1mr16431375edr.7.1692977189795; Fri, 25 Aug 2023 08:26:29 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g10-20020a056402180a00b005234f2c6b21si1210270edy.202.2023.08.25.08.26.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wQhLo3xC; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12790385C6FE for ; Fri, 25 Aug 2023 15:25:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12790385C6FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692977135; bh=ey7LW36IJO5qPYSlIohW8sLPsiYjC50pTLi7oVN+Lu8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=wQhLo3xC5Nrj4laz4ZZ7lW09hlhs5gCerB90oC7wocTofFu5UwT+NQjGMbgcw7vTc N1S+7C+obSalc5Jp+Ip1KmyURyJbJQ7WozKvefi29eCf0qbiHA9GaJvtt+Q0Ncpboe nsw1iereTWjPC+eju8KPgmBTG1igThbrUidi3dUo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 5A3B73858C2D for ; Fri, 25 Aug 2023 15:24:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A3B73858C2D Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37PDOGmK018212; Fri, 25 Aug 2023 15:24:38 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sn1yxphh1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2023 15:24:38 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37PEllVj033208; Fri, 25 Aug 2023 15:24:34 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2174.outbound.protection.outlook.com [104.47.73.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sn1yy0752-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2023 15:24:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/hznbnGs+lmCx8PjpRdVWoKhNqyR2v1cQ3G3XXy2Pz6kLHt/JTnuLj02rNZ2rHGVy29VUX5E3DDHKL4/mm8ezwKFDVZ9dH9ekvggnqvcoN+jVcF9Vxw3IfjWrTk2+1n+OXOrQ9U+bV9ckCQGqKaRBdK/WwxZ7sLJAbgyEuKwDEo1FrbRlg7YMSJpM6uAtckl1QeK2TEQKo19skx2+EWHolMUc+4YyhFIRqTq+xaFXh5YXAd/blQYUsO0GjGDUok/+n+RQykogDTK01bKxp1cUaRd8bBDiGabJFGxVAHfeVyOt79Ta14NkoEqonwEv2dAJiYE8IYkbLgSJrVHlnFFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ey7LW36IJO5qPYSlIohW8sLPsiYjC50pTLi7oVN+Lu8=; b=KDfHZgO6MSrmWoe9+erXyKsNbs8x4rCr41+wj8CAoGZVM8piQxY/QY5nICA/NAjq50LLRe+sr1Msxdyc6n610fXpla/t5Z9ryCJQ5itlpVjuXnva1B10Zd0HwVJjVUaRX0XAu7zqzAHappnn/VaD/z9lrx5JM2s2W+qotbOfcELh6s6ddcd3Ejztt+6zw67Ijp+BcMgek8RkK/UUULho1tMzWkfuuVrL8n5oboT8p5mRhIGuykQoBnoy4HY3Kcd4+ZBZtKPh6MuFL/SQb0Le+WMluyrMvd8zUqr2IOOGjeKDC3618JCmCK4dsVvm7RFYTq+K8qiaTS3ifoXwVMvR7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) by BY5PR10MB4241.namprd10.prod.outlook.com (2603:10b6:a03:208::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 15:24:31 +0000 Received: from CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::5afd:d02a:38ef:94ba]) by CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::5afd:d02a:38ef:94ba%7]) with mapi id 15.20.6699.028; Fri, 25 Aug 2023 15:24:30 +0000 To: joseph@codesourcery.com, richard.guenther@gmail.com, jakub@redhat.com, gcc-patches@gcc.gnu.org Cc: keescook@chromium.org, siddhesh@gotplt.org, uecker@tugraz.at, isanbard@gmail.com, Qing Zhao Subject: [V3][PATCH 0/3] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Date: Fri, 25 Aug 2023 15:24:22 +0000 Message-Id: <20230825152425.2417656-1-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: SJ2PR07CA0019.namprd07.prod.outlook.com (2603:10b6:a03:505::21) To CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR10MB4344:EE_|BY5PR10MB4241:EE_ X-MS-Office365-Filtering-Correlation-Id: b8a7f81c-789f-425b-a635-08dba57f60a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q1jk5uNqZPVgiaAR2pNsMRJLXIqgCDMnrEF96v3bwdUjydphMb89oIz5FXCL8I9lux8I/YPyBKWGU9knuComLAGbOTYFiFYYcYgc0QZ6TOAYENUVWT38ujyYfu8iqp86ooedFxYRYoThckrO2NRHdwh1jlk9Tq7GYpOaxKPXAZU5qbQ91aO/T4ZOcCRzgY5IH5M2RmC+7kopPpsQ1SxDDrvCFZl3s6RsOupXEr7GeN9VG2aEyR2o6X3bT2k2QKkxXAjZ7IRL2lz2VwV++MC09nhrM8paaNVTQ3LZcn7d8da+YwgMgs8LIB2Sn+w5OeEje6kGsIsQ+8jl6gs4U+l6PU565lQNIbk8MpN3KVkM6uETi7njwvLet4AvVMSLrg/ge2J8gIKK7Sk0YwfP1VRyEtP3/VwwsJNOEnHxqv/Y29XYMdlW61HgxxdlUIxgG/GU/1I//kaR+xkAI0OLv8jgoIxbJEcjz44ezBsSLBKLsSEyZVt8P/MsXph3zVwvJGZBCgKfQDwnSHX/ilD/Ae/tKxWv+Vh4FsqI/FTki0lnvUaoq22SmAYvlha72K9WTS9n6Yq866Qv2fS3Xb26o+xcAg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR10MB4344.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(136003)(396003)(39860400002)(366004)(376002)(451199024)(186009)(1800799009)(66946007)(66476007)(66556008)(316002)(478600001)(26005)(44832011)(6666004)(38100700002)(41300700001)(86362001)(6486002)(6512007)(6506007)(2906002)(966005)(8676002)(4326008)(8936002)(1076003)(2616005)(5660300002)(107886003)(83380400001)(36756003)(4743002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RtFqH/h+DYqS8YepeDV1WJ7V0yTWC40j4PdCu7Ckv1KriG6zJ/Yq0nGRxG7FxXZrN1bWC3/ZPp5K4ggMWL6QbRkS+1o6HfTxjo8N5Ogj8z1Jp6tJ93USPZ8pKjUMoEFvgALI8TqSyKpPfhBmNpnLr4f0HelrK6pHIkJKD+YW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lU3Th5qVyvtiaRZgHk7IO/l1twegfISYK8qzoK7WEey44BfoxSVSchMAckJFxz/w086e78M7rAWMo+Df4xLT7KKTe9PcM1Qgh48Mo6/Ft1kQnnXMRyEcN6Ddo3GVZy0V2JOrOXF0RcywhkMVnpTIO/jxW3QTwVTJ+2RFmvL4tO5lm6Yc4dzfuMIFYBtiuAkzRzd170oqf+cwrr3swcyYB8Wt750EML/a9ZOx80pQd1hLIhtuIfq1cuy7USG9pXLzyZKfk1ObWH5BJPNjUzwLajmkWjdnbmow3LJNK X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8a7f81c-789f-425b-a635-08dba57f60a5 X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4344.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 15:24:30.5330 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JAICG0Iohqh94LMs7lZC3iAxE5m3ZLcBUQK7uN3m699UQ4vLjSgByzSH2eCGAgJnvRI4x0xNmmYzKz5siou8Ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4241 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-25_13,2023-08-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308250137 X-Proofpoint-GUID: V9Xrb2QUh0MPfFoVaDcrdFiiZ-vHOmtK X-Proofpoint-ORIG-GUID: V9Xrb2QUh0MPfFoVaDcrdFiiZ-vHOmtK X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Qing Zhao via Gcc-patches From: Qing Zhao Reply-To: Qing Zhao Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775215249513606858 X-GMAIL-MSGID: 1775215249513606858 This is the 3rd version of the patch, per our discussion based on the review comments for the 1st and 2nd version, the major changes in this version are: ***Against 1st version: 1. change the name "element_count" to "counted_by"; 2. change the parameter for the attribute from a STRING to an Identifier; 3. Add logic and testing cases to handle anonymous structure/unions; 4. Clarify documentation to permit the situation when the allocation size is larger than what's specified by "counted_by", at the same time, it's user's error if allocation size is smaller than what's specified by "counted_by"; 5. Add a complete testing case for using counted_by attribute in __builtin_dynamic_object_size when there is mismatch between the allocation size and the value of "counted_by", the expecting behavior for each case and the explanation on why in the comments. ***Against 2rd version: 1. Identify a tree node sharing issue and fixed it in the routine "component_ref_get_counted_ty" of tree.cc; 2. Update the documentation and testing cases with the clear usage of the fomula to compute the allocation size: MAX (sizeof (struct A), offsetof (struct A, array[0]) + counted_by * sizeof(element)) (the algorithm used in tree-object-size.cc is correct). In this set of patches, the major functionality provided is: 1. a new attribute "counted_by"; 2. use this new attribute in bound sanitizer; 3. use this new attribute in dynamic object size for subobject size; As discussed, I plan to add two more separate patches sets after this initial patch set is approved and committed. set 1. A new warning option and a new sanitizer option for the user error when the allocation size is smaller than the value of "counted_by". set 2. An improvement to __builtin_dynamic_object_size for whole-object size of the structure with FAM annaoted with counted_by. there are also some existing bugs in tree-object-size.cc identified during the study, and PRs were filed to record them. these bugs will be fixed seperately with individual patches: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111030 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111040 Bootstrapped and regression tested on both aarch64 and X86, no issue. Please see more details on the description of this work on: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619708.html and more discussions on https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626376.html Okay for committing? thanks. Qing Qing Zhao (3): Provide counted_by attribute to flexible array member field (PR108896) Use the counted_by atribute info in builtin object size [PR108896] Use the counted_by attribute information in bound sanitizer[PR108896] gcc/c-family/c-attribs.cc | 54 ++++- gcc/c-family/c-common.cc | 13 ++ gcc/c-family/c-common.h | 1 + gcc/c-family/c-ubsan.cc | 16 ++ gcc/c/c-decl.cc | 79 +++++-- gcc/doc/extend.texi | 77 +++++++ .../gcc.dg/flex-array-counted-by-2.c | 74 ++++++ .../gcc.dg/flex-array-counted-by-3.c | 210 ++++++++++++++++++ gcc/testsuite/gcc.dg/flex-array-counted-by.c | 40 ++++ .../ubsan/flex-array-counted-by-bounds-2.c | 27 +++ .../ubsan/flex-array-counted-by-bounds.c | 46 ++++ gcc/tree-object-size.cc | 37 ++- gcc/tree.cc | 133 +++++++++++ gcc/tree.h | 15 ++ 14 files changed, 797 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/flex-array-counted-by-2.c create mode 100644 gcc/testsuite/gcc.dg/flex-array-counted-by-3.c create mode 100644 gcc/testsuite/gcc.dg/flex-array-counted-by.c create mode 100644 gcc/testsuite/gcc.dg/ubsan/flex-array-counted-by-bounds-2.c create mode 100644 gcc/testsuite/gcc.dg/ubsan/flex-array-counted-by-bounds.c