Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDB35C433EF for ; Mon, 11 Apr 2022 14:17:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E19AF83ABE; Mon, 11 Apr 2022 16:17:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="FXxcYfH3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A25B483A1E; Mon, 11 Apr 2022 16:17:32 +0200 (CEST) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 66CE583E06 for ; Mon, 11 Apr 2022 16:17:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x831.google.com with SMTP id z16so256724qtq.6 for ; Mon, 11 Apr 2022 07:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=K5XF31YqTmDH2nK83L1LfBt8rlcwCQfjOVeOdSf4bbI=; b=FXxcYfH3NDk2Mf5qnvroz+dXm7Uw33rB5S8ceAA04ijgTQNfDL/gY1lX/hpLEBCNcp Zzuo0AaQz2WKTAgcZKO6U9nMt+3aLOwYpQXOMk2iboegUdqtPW6US1nTDRa4jf47mD2o sh/droKKKdn+xlp4GEmj28r/EgapoUVi3Xw2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=K5XF31YqTmDH2nK83L1LfBt8rlcwCQfjOVeOdSf4bbI=; b=8L5qZCChlU6OUy+LCALvXRf3cDQDLIOkeJX+CNxT1MR1lHnw0mT2HRIYncwO6XQM1I VrGRgRnDqEJBMCIr0/THuPyg4AeNvXRs+24uFUpOAG/elWY86YdQgSUP5/fJfSrtCp+J yzPphHtUnT6q1kKA0tkjFLlJHcbMOyvZMj7NkqL4GyA9W8GlafXOH/3oduzZPebBt2+n V9xeVOeG7y083ioH9NUCdpkgdOW7wFDowCJoDi2CXbec7QVBqEHGS7LY9yc0GwnNzRLZ CIU8sybQ5lCzB4gs8TODaBkC5AfX7FAN3VYtm2kmLZfGA5GP/oYvRH/iLQfbhWGUg4cD 7w6g== X-Gm-Message-State: AOAM532tLE0r7foNAuRBpjW9XojMBI82t/HZdF7bcr+tCccwVKzjkv0f tJy8FxzZHJ4XtJGOTBL2Jhzo4w== X-Google-Smtp-Source: ABdhPJz8ORdzhV43R6AfE8Su4rwzLOT05vQE7b5umyavF3DonPb5ZN5/lFSjWNO7H5/otbU0YOHK7w== X-Received: by 2002:a05:622a:1a28:b0:2e1:102f:915a with SMTP id f40-20020a05622a1a2800b002e1102f915amr26392313qtb.306.1649686648082; Mon, 11 Apr 2022 07:17:28 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id j21-20020ac85f95000000b002e1cde99863sm24623877qta.83.2022.04.11.07.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 07:17:27 -0700 (PDT) Date: Mon, 11 Apr 2022 10:17:25 -0400 From: Tom Rini To: Sean Anderson Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass Subject: Re: [PATCH v3 2/3] malloc: Annotate allocator for valgrind Message-ID: <20220411141725.GC14282@bill-the-cat> References: <20220323180451.48950-1-seanga2@gmail.com> <20220323180451.48950-3-seanga2@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="QPQtldMVT0/5TtBd" Content-Disposition: inline In-Reply-To: <20220323180451.48950-3-seanga2@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean --QPQtldMVT0/5TtBd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 23, 2022 at 02:04:49PM -0400, Sean Anderson wrote: > This annotates malloc and friends so that valgrind can track the heap. To > do this, we need to follow a few rules: >=20 > * Call VALGRIND_MALLOCLIKE_BLOCK whenever we malloc something > * Call VALGRIND_FREELIKE_BLOCK whenever we free something (generally after > we have done our bookkeeping) > * Call VALGRIND_RESIZEINPLACE_BLOCK whenever we change the size of an > allocation. We don't record the original request size of a block, and > neither does valgrind. For this reason, we pretend that the old size of > the allocation was for 0 bytes. This marks the whole allocaton as > undefined, so in order to mark all bits correctly, we must make the who= le > new allocation defined with VALGRIND_MAKE_MEM_DEFINED. This may cause us > to miss some invalid reads, but there is no way to detect these without > recording the original size of the allocation. >=20 > In addition to the above, dlmalloc itself tends to make a lot of accesses > which we know are safe, but which would be unsafe outside of dlmalloc. For > this reason, we provide a suppression file which ignores errors ocurring = in > dlmalloc.c >=20 > Signed-off-by: Sean Anderson > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! --=20 Tom --QPQtldMVT0/5TtBd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmJUOHUACgkQFHw5/5Y0 tyxx3Qv/T+LG8bCTXGhqmGaxihmZ9qAQIpmM1cq5EYMRZ+cvibLRnwhJQ6TfXv5Q jK3n5mR8oT9TfcF2h97ufIRI+3u6ply8mpfue/cjPTQRnZ9XqQorRisIqQppXLiU jptFUiLcZRAwhzJDeHfYjnqTF3/4r4qUCNqYt1YYcIPo0d5kkHEzLTf0IYT4vttp pO2KlDvcvCayVZKXr1Jto1WGjpdicjYfiiHwO1zrSYFWoMoynEEZ5kJ3GCSimTAe kEMcivk5U+lBAL+iA2ab7ANxcC1m1pbkdJutBUbfVEP+SKX4VFTo5U0KhiWMqxKB gVcbEyzafu+1UPMptPcZ3IGM57BcgzsGPffZvnuKmAA7WJ9WuQicSBoLHLtx2TDP G/U+5CxiqHfyDOgcOFyu7T7tSPfw4akycdoYJWVLyfSoUu6/yOiLfpOSs+24fLrN RTLhhq6NnLGepR7jD3RQ1Yn0VhsngiQM/lEv5ZShrPzJdX+lpCWc7QMmmrz94Cv4 3mv8B0sS =huDD -----END PGP SIGNATURE----- --QPQtldMVT0/5TtBd--