From: Jens Axboe <axboe@kernel.dk>
To: linux-btrace@vger.kernel.org
Subject: Re: [PATCH 0/2] Fix issues in check_cpu_map
Date: Thu, 21 Oct 2021 14:45:29 +0000 [thread overview]
Message-ID: <340516b3-b928-9013-aa9f-507233585fb1@kernel.dk> (raw)
In-Reply-To: <20211021141620.2878-1-jeffm@suse.com>
On 10/21/21 8:16 AM, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
>
> Hi folks -
>
> I received a bug report[1] where blkparse would crash on pipe input. It
> was not reproducible and, looking at the core dump, it appears to be due
> to the first event being dropped such that we end up going down the
> check_sequence path to check_cpu_map with bit->sequence = 2 first the
> first sequence. check_cpu_map would do a malloc(0) and then write past
> the end of the (empty) range, ultimately causing a crash in free() due
> to glibc's magic byte at the end of the buffer being overwritten. Since we
> don't do CPU online tracking on pipe input and file input will online at
> least one CPU or exit, we can skip the rest of the body if the CPU map
> is empty.
>
> While looking at this, I also found that the memset always uses
> sizeof(unsigned long *) as its size regardless of the allocated since.
> I've replaced that with a calloc.
Applied, thanks Jeff.
--
Jens Axboe
prev parent reply other threads:[~2021-10-21 14:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 14:16 [PATCH 0/2] Fix issues in check_cpu_map jeffm
2021-10-21 14:45 ` Jens Axboe [this message]
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=340516b3-b928-9013-aa9f-507233585fb1@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-btrace@vger.kernel.org \
/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).