From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BC9661F531 for ; Mon, 10 Aug 2020 13:44:39 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A40723851C25; Mon, 10 Aug 2020 13:44:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A40723851C25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1597067078; bh=jDRmWf1+97JcGKEf6XXFJKHzOmB7RZBfOGSiWPjBrEQ=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=S9adgEspJ5L+1fFPqOLDiACDVn5tQVCQqo43EWi/jsVfNKhW5jRxTKffCGHUjTskk 3wB7z/v4dbB4dnH/qk8obRoUXgA7jyreDxvscPGMAczhSZcHixivIT9UqW2qPkp5gA eW6gDB2A+LlX7aGagm+u9rexVcMNJhhlNdaZVpDY= Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id C83E53851C25 for ; Mon, 10 Aug 2020 13:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C83E53851C25 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-54SwFyOANrmkS4-84s33eA-1; Mon, 10 Aug 2020 09:44:34 -0400 X-MC-Unique: 54SwFyOANrmkS4-84s33eA-1 Received: by mail-qt1-f198.google.com with SMTP id u17so7483157qtq.13 for ; Mon, 10 Aug 2020 06:44:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=jDRmWf1+97JcGKEf6XXFJKHzOmB7RZBfOGSiWPjBrEQ=; b=s5PCh/TiW6YaTIo6yb3XROEcaRcy8Ywkv/Qh4F+d2Yx8TaNxfc9TCG7Mf39O4mvI0g X2Ld2Lt2dGNUD3pxrwkt2/MKEKz638mRcPturUS0Z9W7mriDCHnLRaUFB24tG/TYt9Xn Ktb+8Pi7/Gfzds2sO3PcYm2iXKOut2iUKGLON2uHZ6ZJg7TbDdwYGtu7Fh/O0e9S2v84 jfJr1fWMgrAQ6Dg2c2sP6QKMIz63poFbHgaUO0HbvYrmtjU4rHGUP5LY0y83cO27thHw zBn3kaiDPdaqN22iIINKFUwfeUOu8PJmSSQdmBPDe+BPK94bBCQjxrzMrEzoPgwxHyw0 XW0w== X-Gm-Message-State: AOAM532a/tCSIxeg/0WtDA7LaaPcjmgrDadvIysN0WruLPwVuHOPOOTv QG8VpJmJkh2qAFYP8sam1UVKm1RBpyVRksd+hZSMBK15Ncd2lTUTbObiVn92HRZYe4oKZ81K9tN KMtM9Z40gs3wUV/WBYLl3 X-Received: by 2002:a37:a30b:: with SMTP id m11mr26535825qke.12.1597067073899; Mon, 10 Aug 2020 06:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2xfSHMsqSyFaT+mSvq9d/TjTqNkljlKIToBEkxY1gqfmBniU9y2AgcyehzTHYsCwGpLiX+A== X-Received: by 2002:a37:a30b:: with SMTP id m11mr26535799qke.12.1597067073625; Mon, 10 Aug 2020 06:44:33 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id u21sm13747085qkk.1.2020.08.10.06.44.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 06:44:33 -0700 (PDT) Subject: Re: [PATCH] Update tcache double-free check To: Eyal Itkin References: <22dd78e7-13a7-0bec-37ba-f3e32a9630ab@redhat.com> <5c6aa5c1-7962-6f05-a114-0d79c9cd9bc5@redhat.com> Organization: Red Hat Message-ID: <897cace4-79a9-9562-7c56-27a4895f837a@redhat.com> Date: Mon, 10 Aug 2020 09:44:31 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Cc: Florian Weimer , GNU C Library Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 8/10/20 9:35 AM, Eyal Itkin wrote: > The overall scheme for accumulating random between threads might be > useful in the future, for a cookie-style security check, however I > convinced myself that it won't be needed in this case. Your analysis seems sensible to me. In the case of a cookie-style check I think we can and *should* do this with some of the chunk metadata. This is something Florian proposed a couple of years ago, but the difficulty is that it's straight on the hot path, so you have to try reorder the operations to get as-good performance as before. Given that you're already touching the cacheline with the metadata there is a lot that you can hide e.g. xor of the size with a cookie. You're right though the code you've written I think will be useful to others. I still need to review the various versions we have and get consensus. -- Cheers, Carlos.