From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2053.outbound.protection.outlook.com [40.107.14.53]) by sourceware.org (Postfix) with ESMTPS id 879853858D20 for ; Wed, 5 Apr 2023 13:56:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 879853858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UNlNX/vdhQw/4ffVuo4kJ13JPXzKml0c/piKdHwQo5A=; b=Vd/rx9WeK0xbD0Zok5ghRF/v2DGgtW6iMn+2uFVdHV+q2D3fEezh/fFUj0y33szt5PQ670+EJ6Cw0vJWbY6nziQkbODb4QbvwHMVsX+IC2aEJUnKaVEFDz0/9dme4qTTL3lp7RfDbV4OvAXaBZXvYRebgmHz3EHSiofVkcO0kro= Received: from DB3PR06CA0005.eurprd06.prod.outlook.com (2603:10a6:8:1::18) by DBAPR08MB5798.eurprd08.prod.outlook.com (2603:10a6:10:1a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Wed, 5 Apr 2023 13:56:04 +0000 Received: from DBAEUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::1e) by DB3PR06CA0005.outlook.office365.com (2603:10a6:8:1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.28 via Frontend Transport; Wed, 5 Apr 2023 13:56:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT016.mail.protection.outlook.com (100.127.142.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.16 via Frontend Transport; Wed, 5 Apr 2023 13:56:03 +0000 Received: ("Tessian outbound 3a01b65b5aad:v136"); Wed, 05 Apr 2023 13:56:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 135da1ab2c560ad1 X-CR-MTA-TID: 64aa7808 Received: from 9350ee7d09fe.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DA0FB3CB-40AE-4616-AF8E-41B719C3DB34.1; Wed, 05 Apr 2023 13:55:56 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9350ee7d09fe.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 05 Apr 2023 13:55:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GxNQ41ISdPPxEK0xZs8ZZ5kTEmKfh10t4ifTlzexfUZ8EqyR3KPAd9VZiG47YimK2mwlNIiqYa616VhiAnS2rXWqcfNU56nTGhOk9Jk7SvKvOFnFlPRMVIv6JyTjkMgG+3r/LrvpaI99r4Kb9xtlNWlZTiKOtsxDh8zdWoQ4eL/8uWIf5lAgqPdjSL3kW5pIrUTSUEJRgaxWDhhAWK+TzNiUl9fWdg29Pr1m2fAO5Db61DIOi2U6dpVVko+JUoOsrFXeAfbLDIVHLnrrLGtuxMuLhDIroWlbKBR2Z2kyY6mfYIAZMrsxSaeU5NDpp/caBdxOkv3kXAR5VJJbGarElA== 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=UNlNX/vdhQw/4ffVuo4kJ13JPXzKml0c/piKdHwQo5A=; b=R/mekDzh1as5QWnpeMZOFm+Hp1V1dtU5LD7CBrGoGuV6DbAIN5GphMw2U+2dMrxbnlwpY6/9Un+KE6YP85MlP8p1jHfzJua1E/nAT94ibNBJVhBXq8rxdNUMfVr+/0JvtSSBydTombtSDFfjkj1qBSztOqrJbVDCFIWUp5jPCu2TrDaJzN371z8LaDNfKA/v9R2katDINwhO1gyRG7Qhe6bLVPFspveKFy4JLKcS0tNuCVIS8ynhHbQRRV/8PGewY/ak7RbDI0OEZheoSfCmlkN7XAyqtXIvQcKp9uyJApMdbtGBp2GSDZN7lupDietCGWOsvtW1DFwT+4e8jg5YBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UNlNX/vdhQw/4ffVuo4kJ13JPXzKml0c/piKdHwQo5A=; b=Vd/rx9WeK0xbD0Zok5ghRF/v2DGgtW6iMn+2uFVdHV+q2D3fEezh/fFUj0y33szt5PQ670+EJ6Cw0vJWbY6nziQkbODb4QbvwHMVsX+IC2aEJUnKaVEFDz0/9dme4qTTL3lp7RfDbV4OvAXaBZXvYRebgmHz3EHSiofVkcO0kro= Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by DB9PR08MB9634.eurprd08.prod.outlook.com (2603:10a6:10:461::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Wed, 5 Apr 2023 13:55:53 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::13be:967d:6e80:432f]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::13be:967d:6e80:432f%9]) with mapi id 15.20.6254.030; Wed, 5 Apr 2023 13:55:53 +0000 From: Wilco Dijkstra To: "Alejandro Colomar (man-pages)" CC: 'GNU C Library' , Siddhesh Poyarekar Subject: Re: [RFC PATCH] malloc_usable_size.3: Warn about _FORTIFY_SOURCE interaction Thread-Topic: [RFC PATCH] malloc_usable_size.3: Warn about _FORTIFY_SOURCE interaction Thread-Index: AQHZZ8SQ03nzizYtuE+nDpstC5QCGg== Date: Wed, 5 Apr 2023 13:55:53 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAWPR08MB8982:EE_|DB9PR08MB9634:EE_|DBAEUR03FT016:EE_|DBAPR08MB5798:EE_ X-MS-Office365-Filtering-Correlation-Id: 27b2f30e-c549-4334-ee49-08db35dd7f16 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6IdhjsCJCIqEsRzNSAA/eAkkwOi1ybOOUCrWijKpgRk4JQC/l8FnRyqbv8u1EVQ3nANeVQgJCDol7lQu4nHCGQzm4RTgeSN2xPWswfAWCxlh4jpy9/VRuaNz07foadG9WzqdhvI4C94XbL/wuMzlcvDh2kkpgfVh18y9ti1C0k2T3VH5dMC1Bvu7UL9bfyVlHhekoLo7tfUefRqHd+kc+IGbVI/ZTdd+IqDIUL+X4BOdU8tuYyhbgIOfZWThR2XCWEq34rw08YyGHCmAF7k8xew2UZF9tBMEMFogY6sx9hZ5JZ8E0OV1B9db8Cmy2VGrRPYAYvHH1zLzzE3wpY8z6AmPgbrk03kcNzY+AA8J8664QtEmfOZRCo8oNMpXqRVhy7N/Z/FWhPBjDrpRRm1OQmyYWN5dAF1Rhu4opc9MovzVoDNDPK7nGGz/zTdsZUQRcJhoXvpSa0qyxhy2gr+6T2KrQxMIcnuun6tdmsFV78JTgAjaYYJy9IL6lwt33uXI8rJ6VpfkCOuI6KtL3aiRhzksnXoeM5naLUmY5hpZim3jdqBIuthL3DuHV2CiYFYgxttLaGUmlLdzhV6ApR082k/wk+mKwA/DZClx/NzbXPM= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAWPR08MB8982.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(39860400002)(376002)(346002)(396003)(451199021)(186003)(9686003)(6506007)(26005)(55016003)(33656002)(64756008)(478600001)(54906003)(7696005)(71200400001)(38100700002)(66446008)(86362001)(66946007)(316002)(66556008)(8676002)(4326008)(83380400001)(6916009)(122000001)(91956017)(41300700001)(2906002)(76116006)(66476007)(5660300002)(52536014)(8936002)(38070700005);DIR:OUT;SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9634 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f90115a1-d3ce-45fc-d427-08db35dd78ab X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 36Dvqm2SQTKtrDYlU32SJuhTKa5T4muyWdUAVnyg2CBws5clvD+xedZoiPVta0poI6Vl53F+mVdY3Y5iSy+oSm6hVwCOZT56+GS3Z0Q9koKGTRalDj6kUXc6qqXEEPW30uuQ+0oHBavDiLkdbW5Guj7gS6gEEvWS7rjDfcOJWZ2xysEGyxWAGxMH9nTqpY3C8ul7fByTyHpGKUVQ7A5eDUeOJ4vmEKxN7VpbX1KCNl4j2hEW4vMFxOlYMJx3WqYtEC4mkkE5GdMt5j+lpDsaNnb9qYEn/ZjxSRh3xtMeUlpQihLGJeOQwXkFpx9NER/9HGy0CP8vzPFVCcUgRkBZVkH3M1aYDCmaKUQh3dU2TuRNkEbEkbjFT3jU54JEYdgG5SsrtMc1+r5e/w7N6ZfIVuzQYh3si12V7MkyVbMiPD3MYq9l3ErxRLqM8niPtRxyJvEOTLlJfV0rAmSmPIqXoEPmgzfLHgpROknMi44gjPCqZRxgXI8SBEQ2fny44dC5lRBaStRWWe6MPXLBpDOkatdyOkQdA1v55qaKFu9/uCJBZ4mKrJL3av1i8sF+naHth+2o+BD/DjzBM72DWlaS9uD0JonWTsQ/9bCtOobWcPDoeAptz31Xx2i1yTuhNdE95rVg6SoJQuUuKB0Yms1lXIXTcX+b32tFB0j5feyLIoIvz0A2dxbpGJnbfeehTsZe X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(376002)(39850400004)(136003)(451199021)(36840700001)(40470700004)(46966006)(86362001)(40460700003)(82310400005)(55016003)(40480700001)(33656002)(4326008)(336012)(52536014)(6506007)(107886003)(9686003)(82740400003)(26005)(8676002)(186003)(5660300002)(70586007)(8936002)(7696005)(54906003)(2906002)(478600001)(316002)(41300700001)(70206006)(36860700001)(81166007)(356005)(6862004)(47076005)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2023 13:56:03.9154 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27b2f30e-c549-4334-ee49-08db35dd7f16 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5798 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Alejandro,=0A= =0A= > and the header where we define a wrapper macro, which contains several=0A= > comments about assumptions made about different libc implementations:=0A= > =0A= > =0A= > =0A= > I hope that tells you something. It doesn't tell me anything, but I'm=0A= > not used to fiddling with allocators. :)=0A= =0A= This looks rather worrying - it seems to deliberately use a malloc size tha= t is too=0A= small in the hope that the particular malloc implementation allocates a bit= more=0A= and then use that extra space. So every malloc call now needs extra checks = to=0A= adjust the size and another call to malloc_usable_size which then needs to = be=0A= checked to be larger than the original requested size...=0A= =0A= So basically they are trying to save 32 bytes in blocks larger than 128KB= =0A= (a whopping 0.024%!!!) by adding ~64 bytes of extra code per malloc call pl= us=0A= lots of extra executed instructions...=0A= =0A= This kind of stupidity convinces me even more that we need to obsolete=0A= malloc_usable_size - people clearly cannot use it properly or avoid=0A= hardcoding internal implementation details which could change at any time.= =0A= =0A= Cheers,=0A= Wilco=