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 2331CA04FF for ; 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 EC01840042; Thu, 5 May 2022 11:10:58 +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 A4C2440042 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-453-TfFTsiqNMkWv2T7KvIN4gw-1; Thu, 05 May 2022 05:10:55 -0400 X-MC-Unique: TfFTsiqNMkWv2T7KvIN4gw-1 Received: by mail-lj1-f200.google.com with SMTP id x12-20020a2e9dcc000000b0024f2bb07cb8so1195660ljj.13 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=Gogvse/kLHBE8o9wDvQEwX2iMYg3sgOIjnGAnP3yyrhqU5HjnAnLCXVKPYbz8DSut7 sGpmIvRKzlGG/zxRnTiMr7boXqxSJtWLF+kNnAHrE3wFAjvRd9xCWaG4dKifAA2gCFF5 z3bJIq0heD3QNfXtHwOkW8MMRkE9t5gfbLafC+Y44qFx6O/zc2HaLC4hjtOo0Wm5G/Eh gIssSY+BlCFjg3WO9d6rPikO27JQSadG21aY4hsZtO5aeS/6b8QRTihcasNDA/g2XITp PXK81H2UKyrNfkO9R9sJayghy9RGJTI6ilP/kFyYdpcT0+nl9tiF3w1k5KsXMRxBPuYE uV5g== X-Gm-Message-State: AOAM532swjYcyqmgLRuqWsqPoSxrBESERUMhRje4Un29BKIZ2aLbF7BJ 3lcIUUTUni5F1QZiz3F+4Ds4W1kIJnyC8VHbiFZaM1NUVL8whFyDF4PX66VmuLpzi+HGgLmw4eC u1VgHDrHDzjBjmbdJpi2qAHw= X-Received: by 2002:a2e:81d1:0:b0:24f:728:a16c with SMTP id s17-20020a2e81d1000000b0024f0728a16cmr15787340ljg.333.1651741854426; 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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