DPDK patches and discussions
 help / color / mirror / Atom feed
From: "wuchangsheng (C)" <wuchangsheng2@huawei.com>
To: "anatoly.burakov@intel.com" <anatoly.burakov@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"jiangheng (G)" <jiangheng14@huawei.com>,
	"Yanan (Euler)" <yanan@huawei.com>
Subject: malloc_heap: Possible Control Block Overwrite When Insufficient Space in Elem
Date: Thu, 30 Mar 2023 11:34:10 +0000	[thread overview]
Message-ID: <08db5578898e483992ab35bfacb424c5@huawei.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

Hello,

I seem to have discovered a problem in the heap memory allocation and deallocation operations.

    |------------------|----------------------------|

  elem  padsize    newelem

In the malloc_elem_alloc function, when padsize > cache-line (such as 64 bytes) and padsize < sizeof(struct malloc_elem), the initialization of new_elem will overwrite and damage the struct malloc_elem information of elem, while setting the state of new_elem to ELEM_PAD. When releasing new_elem in malloc_elem_free, it will be converted to elem using RTE_PTR_SUB(new_elem, new_elem->pad), but at this point, the struct malloc_elem information of elem is damaged.


[-- Attachment #2: Type: text/html, Size: 3257 bytes --]

                 reply	other threads:[~2023-03-30 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08db5578898e483992ab35bfacb424c5@huawei.com \
    --to=wuchangsheng2@huawei.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiangheng14@huawei.com \
    --cc=yanan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).