From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9AEBA04FF; Thu, 5 May 2022 11:10:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F2DF4281A; Thu, 5 May 2022 11:10:59 +0200 (CEST) Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by mails.dpdk.org (Postfix) with ESMTP id AF67240C35 for ; Thu, 5 May 2022 11:10:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651741857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5O+qNu4iMBQ9UkvbMaeXTaIVKrfdvXnTndGNCnORqzM=; b=Qsp5oKXpBpIJdW76/SrVheZyk2QU2MkkEdAJHbrYWNQXInVGpVK4yNWh/NDocMwbFsq1co PNWu7Vmed4huw1z/w5zh9BXfssaHnFHZuP/cXdoEDuhUqpeSNQ3rHZh4XGNZZnZYyTVlgO WPzRTBdQ1APOsSB3HOOCE3sskNJQzVA= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-2pI2LRPmMJ2RPZOWsYoIyQ-1; Thu, 05 May 2022 05:10:56 -0400 X-MC-Unique: 2pI2LRPmMJ2RPZOWsYoIyQ-1 Received: by mail-lj1-f200.google.com with SMTP id 194-20020a2e09cb000000b002508b2e655dso817072ljj.11 for ; Thu, 05 May 2022 02:10:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5O+qNu4iMBQ9UkvbMaeXTaIVKrfdvXnTndGNCnORqzM=; b=lokDnadym/hq3ReJnmmFEI9SI3DgjsznbaKFK9hPQvcO4lfLmi+PKMn10dkiIIjXde vZ9ecepNMfN7DIWOugoLOvSYkwmC4TbgT7poJAopGb+QgdOEcCtXnYkH+Cjz45Ixf523 RmAgMpjIIto8YvXYsYkKSGEpEs4X9QWlStIpV/2+NEKLW6Iso16w5PrsF5b+hz26f0za nDk4SZDZ0CT5ujvO6CJrhzHa9+X9L8roM1Ml41k/kx4xvKAqtqm0C6uWBODwREVrDb8q GOMumOGwmW/6Agktkaax/JhyLGXfcgYEPiU3+rzgNwrC/aTo3vA1S8RVWi6hiAtnk0mX QaTg== X-Gm-Message-State: AOAM532iIcub2HysA8BwCTxv7K8i1xHMBMGliTF4Qc7lBUixCAWrY/rP 4T4B/HdQkOqazVQ9ooEuDuzmNtyapkdkJr+HiMslqzazyPJPw9a/bDtSnq+7krye6JZqOoOYBzv easZee9RDTHG5XajQLDs= X-Received: by 2002:a2e:81d1:0:b0:24f:728:a16c with SMTP id s17-20020a2e81d1000000b0024f0728a16cmr15787347ljg.333.1651741854506; Thu, 05 May 2022 02:10:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDuUYo/DJzmJkmn5CMYq6i5gtRJgJyXsZ0RrR1jNa9v7xyzo+PEcM31lQFqQ41mTTWRI+2OVQVfb3F/eg1RXc= X-Received: by 2002:a2e:81d1:0:b0:24f:728:a16c with SMTP id s17-20020a2e81d1000000b0024f0728a16cmr15787333ljg.333.1651741854213; Thu, 05 May 2022 02:10:54 -0700 (PDT) MIME-Version: 1.0 References: <54f5fe8c3e8ba5412dc34bace1409c44efd6035a.1651674707.git.anatoly.burakov@intel.com> In-Reply-To: <54f5fe8c3e8ba5412dc34bace1409c44efd6035a.1651674707.git.anatoly.burakov@intel.com> From: David Marchand Date: Thu, 5 May 2022 11:10:42 +0200 Message-ID: Subject: Re: [PATCH v2 1/1] malloc: fix ASan handling for unmapped memory To: Anatoly Burakov Cc: dev , Xueqin Lin , Vladimir Medvedkin , dpdk stable Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, May 4, 2022 at 4:32 PM Anatoly Burakov wrote: > > Currently, when we free previously allocated memory, we mark the area as > "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a > malloc element will cause pages to be unmapped from memory and re-backed > with anonymous memory again. This may cause ASan's "use-after-free" > error down the line, because the allocator will try to write into > memory areas recently marked as "freed". > > To fix this, we need to mark the unmapped memory area as "available", > and fixup surrounding malloc element header/trailers to enable later > malloc routines to safely write into new malloc elements' headers or > trailers. Bugzilla ID: 994 > Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") > Cc: stable@dpdk.org > Reported-by: David Marchand > Signed-off-by: Anatoly Burakov It fixes the issues I saw with unit tests. Applied, thanks for working on this problem. I'll respin my series that enables ASan in GHA. -- David marchand