From libc-alpha-bounces@sourceware.org Tue Apr 13 18:16:03 2021 Return-Path: Received: from rhel8.vm (localhost [127.0.0.1]) by rhel8.vm.delorie.com (8.15.2/8.15.2) with ESMTP id 13DMG301391452 for ; Tue, 13 Apr 2021 18:16:03 -0400 Received: from mail.corp.redhat.com [10.4.203.66] by rhel8.vm with IMAP (fetchmail-6.3.26) for (single-drop); Tue, 13 Apr 2021 18:16:03 -0400 (EDT) Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO zmta01.collab.prod.int.phx2.redhat.com) (10.5.81.8) by zmail21.collab.prod.int.phx2.redhat.com with LMTP; Tue, 13 Apr 2021 18:14:23 -0400 (EDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B6DCE189F49 for ; Tue, 13 Apr 2021 18:14:23 -0400 (EDT) Received: by smtp.corp.redhat.com (Postfix) id 8275F208DDAC; Tue, 13 Apr 2021 22:14:23 +0000 (UTC) Delivered-To: dj@redhat.com Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CBC4208DDAB for ; Tue, 13 Apr 2021 22:14:23 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66F0085A5B5 for ; Tue, 13 Apr 2021 22:14:23 +0000 (UTC) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=dkim.mimecast.com; s=201903; t=1618352063; h=from:from:sender:sender:reply-to: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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=nlp1IRSG3+oZ6rK0ykTfalh0JJzj2sN9SgPfmxKdr24=; b=MeTuzJnbTdPmNQ2bj2jklYewidmgRGKKqyHHwCEztyQ94sSGPSttqwFV9GQIuyBsJ6RFjz Y0n/qHqkzFsXBDKHXMLrAym/9IlrIoRoYgo3O7wX4VKax5RpA3xDxu0Bz4Cgh49/yfiAYZ wDmuSrlQUvRsLcVjIRqm5z7vPdWtWghSJ/Q3d/EZ1ng1ZZulh8UvCwIEExQvHJbSDgeUPH 9L0GCX6FAoFMufAr3ryza1J67WC38gdrqqtQ5Yc5aXVrjBileLhTAA/uKbU0VOOKhFOWju vnKNYKEVlAz9UdMxVbd+NwDwdQMlYeP/mc4OZkcaUYQNg5HtNyY8fDCga1C73A== ARC-Seal: i=1; s=201903; d=dkim.mimecast.com; t=1618352063; a=rsa-sha256; cv=none; b=mhSNY76p3kKkUgWDMrokXODbS3b7Ovj9Zarefe75tarMICL9G4WXb0drfaQMG4Vc36pVuQ yf1T2Vo8gtbUx3fzPyIUFBWFwT7gS/rrlpkr1KUvy68HNg35bWEE8BHSiojhR8yuNuHy8n Jo6wDgFz3AzmJto+0HxacsJqw+9zlieTO3PWWuoouwCtpua03Skbqu1eRnxDxuFUyjtu/A bftEMKl+LZPWa+a3+P9GZTZLBYJZMYrR6lKjAdO7cfIWtBtvmvXbjk7hjeSc4VK5vH76bL E/9VGmO1NkOrguMN/PFus/7bpwztpUASJwbDkFg9oCtqL7EFsRIpte9hVES4fQ== ARC-Authentication-Results: i=1; relay.mimecast.com; dkim=pass header.d=sourceware.org header.s=default header.b=eKkBGt9Q; dmarc=pass (policy=none) header.from=sourceware.org; spf=pass (relay.mimecast.com: domain of libc-alpha-bounces@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom=libc-alpha-bounces@sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-hcTNE2PVPk-bqpn46cRelQ-1; Tue, 13 Apr 2021 18:14:19 -0400 X-MC-Unique: hcTNE2PVPk-bqpn46cRelQ-1 Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC0F73953D36; Tue, 13 Apr 2021 22:14:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC0F73953D36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1618352056; bh=nlp1IRSG3+oZ6rK0ykTfalh0JJzj2sN9SgPfmxKdr24=; h=To:Subject:In-Reply-To:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eKkBGt9QS63TStreNVO5Jc8e0wQLx5YxLOrupSxWxiqweYd3ygEcyI8hPMP8rEnxh Ynn8JRIMFoi4aISsel6B1gotEOlT9HheJCfm8QVMHZBbISXPMmb32uknuVSiJrpwl4 oQ4wOXQIhptJdqRIp8nvVd/z+fk6iFDrIRDuO0lI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 8B3793951C83 for ; Tue, 13 Apr 2021 22:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8B3793951C83 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-L7ja44BRPp-pIyG-gMj8mw-1; Tue, 13 Apr 2021 18:14:12 -0400 X-MC-Unique: L7ja44BRPp-pIyG-gMj8mw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93EB6107ACC7; Tue, 13 Apr 2021 22:14:11 +0000 (UTC) Received: from rhel8.vm.delorie.com (ovpn-112-40.rdu2.redhat.com [10.10.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65B2A1A49B; Tue, 13 Apr 2021 22:14:11 +0000 (UTC) Received: from rhel8.vm.redhat.com (localhost [127.0.0.1]) by rhel8.vm.delorie.com (8.15.2/8.15.2) with ESMTP id 13DMEAKT391440; Tue, 13 Apr 2021 18:14:10 -0400 To: liqingqing Subject: Re: [PATCH] malloc: Print error when oldsize is not equal to the current size. In-Reply-To: <4574b99b-edac-d8dc-9141-79c3109d2fcc@huawei.com> (message from liqingqing on Thu, 1 Apr 2021 16:51:45 +0800) Date: Tue, 13 Apr 2021 18:14:10 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: DJ Delorie via Libc-alpha Reply-To: DJ Delorie Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Authentication-Results: relay.mimecast.com; dkim=pass header.d=sourceware.org header.s=default header.b=eKkBGt9Q; dmarc=pass (policy=none) header.from=sourceware.org; spf=pass (relay.mimecast.com: domain of libc-alpha-bounces@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom=libc-alpha-bounces@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored External Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User Name=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat Dictionary=false;Custom Threat Dictionary=false X-Mimecast-Bulk-Signature: yes X-Mimecast-Spam-Signature: bulk Content-Type: text/plain; charset=utf-8 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by rhel8.vm.delorie.com id 13DMG301391452 liqingqing writes: > the read of the oldsize is not protected by any lock, so check this value to avoid causing bigger mistakes.  Normally nothing can change oldsize until the oldp chunk is returned to the arena, and at the point where you added the check that hasn't happened. Could you be more specific about how this value might change out from under us? Is this a case of "some other thread might corrupt this"? But that can happen regardless of lock. Are you assuming some other malloc/free call could corrupt oldsize while they hold the lock? If so, is there a published exploit description for this?