* blktrace segfault.
@ 2007-10-28 10:53 Aneesh Kumar K.V
2007-10-29 19:47 ` Jens Axboe
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2007-10-28 10:53 UTC (permalink / raw)
To: linux-btrace
Core was generated by `blktrace -d /dev/hdc'.
Program terminated with signal 11, Segmentation fault.
#0 0xb7e4cdec in ?? ()
(gdb) where
#0 0xb7e4cdec in ?? ()
#1 0xb7dbf000 in ?? ()
#2 0x00021000 in ?? ()
#3 0xb7dee6e8 in ?? ()
#4 0x0804ecf0 in ?? ()
#5 0x00000001 in ?? ()
#6 0x6c616367 in ?? ()
#7 0xbfee3f68 in ?? ()
#8 0xb7f51300 in ?? ()
#9 0x00000168 in ?? ()
#10 0x0804ecf0 in ?? ()
#11 0x00000001 in ?? ()
#12 0xbfee3f88 in ?? ()
#13 0xbfee3f68 in ?? ()
#14 0x080499dc in close_thread (tip=0xb7f1eff4) at blktrace.c:637
Backtrace stopped: frame did not save the PC
(gdb)
the below diff fix the same.
diff --git a/blktrace.c b/blktrace.c
index 42613a7..4f4fcde 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -1220,6 +1220,7 @@ static int start_devices(void)
size = ncpus * sizeof(struct thread_information);
thread_information = malloc(size * ndevs);
+ memset(thread_information, 0, size*ndevs);
if (!thread_information) {
fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
return 1;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: blktrace segfault.
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
@ 2007-10-29 19:47 ` Jens Axboe
2007-11-14 9:39 ` Jan Blunck
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2007-10-29 19:47 UTC (permalink / raw)
To: linux-btrace
On Sun, Oct 28 2007, Aneesh Kumar K.V wrote:
> Core was generated by `blktrace -d /dev/hdc'.
> Program terminated with signal 11, Segmentation fault.
> #0 0xb7e4cdec in ?? ()
> (gdb) where
> #0 0xb7e4cdec in ?? ()
> #1 0xb7dbf000 in ?? ()
> #2 0x00021000 in ?? ()
> #3 0xb7dee6e8 in ?? ()
> #4 0x0804ecf0 in ?? ()
> #5 0x00000001 in ?? ()
> #6 0x6c616367 in ?? ()
> #7 0xbfee3f68 in ?? ()
> #8 0xb7f51300 in ?? ()
> #9 0x00000168 in ?? ()
> #10 0x0804ecf0 in ?? ()
> #11 0x00000001 in ?? ()
> #12 0xbfee3f88 in ?? ()
> #13 0xbfee3f68 in ?? ()
> #14 0x080499dc in close_thread (tip=0xb7f1eff4) at blktrace.c:637
> Backtrace stopped: frame did not save the PC
> (gdb)
>
>
> the below diff fix the same.
Thanks, applied!
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: blktrace segfault.
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
2007-10-29 19:47 ` Jens Axboe
@ 2007-11-14 9:39 ` Jan Blunck
2007-11-14 9:45 ` Jens Axboe
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jan Blunck @ 2007-11-14 9:39 UTC (permalink / raw)
To: linux-btrace
On Sun, Oct 28, Aneesh Kumar K.V wrote:
>
> the below diff fix the same.
>
> diff --git a/blktrace.c b/blktrace.c
> index 42613a7..4f4fcde 100644
> --- a/blktrace.c
> +++ b/blktrace.c
> @@ -1220,6 +1220,7 @@ static int start_devices(void)
> size = ncpus * sizeof(struct thread_information);
> thread_information = malloc(size * ndevs);
> + memset(thread_information, 0, size*ndevs);
> if (!thread_information) {
> fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
> return 1;
I'm pretty sure you want to make the memset after the NULL-pointer check. If
malloc fails this is segfaulting too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: blktrace segfault.
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
2007-10-29 19:47 ` Jens Axboe
2007-11-14 9:39 ` Jan Blunck
@ 2007-11-14 9:45 ` Jens Axboe
2007-11-14 9:51 ` Christoph Hellwig
2007-11-14 9:53 ` Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2007-11-14 9:45 UTC (permalink / raw)
To: linux-btrace
On Wed, Nov 14 2007, Jan Blunck wrote:
> On Sun, Oct 28, Aneesh Kumar K.V wrote:
>
> >
> > the below diff fix the same.
> >
> > diff --git a/blktrace.c b/blktrace.c
> > index 42613a7..4f4fcde 100644
> > --- a/blktrace.c
> > +++ b/blktrace.c
> > @@ -1220,6 +1220,7 @@ static int start_devices(void)
> > size = ncpus * sizeof(struct thread_information);
> > thread_information = malloc(size * ndevs);
> > + memset(thread_information, 0, size*ndevs);
> > if (!thread_information) {
> > fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
> > return 1;
>
> I'm pretty sure you want to make the memset after the NULL-pointer check. If
> malloc fails this is segfaulting too.
Ehm that's indeed a good point, I'll check in a fix for that.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: blktrace segfault.
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
` (2 preceding siblings ...)
2007-11-14 9:45 ` Jens Axboe
@ 2007-11-14 9:51 ` Christoph Hellwig
2007-11-14 9:53 ` Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2007-11-14 9:51 UTC (permalink / raw)
To: linux-btrace
On Wed, Nov 14, 2007 at 10:45:30AM +0100, Jens Axboe wrote:
> > > size = ncpus * sizeof(struct thread_information);
> > > thread_information = malloc(size * ndevs);
> > > + memset(thread_information, 0, size*ndevs);
> > > if (!thread_information) {
> > > fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
> > > return 1;
> >
> > I'm pretty sure you want to make the memset after the NULL-pointer check. If
> > malloc fails this is segfaulting too.
>
> Ehm that's indeed a good point, I'll check in a fix for that.
Even better just use calloc..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: blktrace segfault.
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
` (3 preceding siblings ...)
2007-11-14 9:51 ` Christoph Hellwig
@ 2007-11-14 9:53 ` Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2007-11-14 9:53 UTC (permalink / raw)
To: linux-btrace
On Wed, Nov 14 2007, Christoph Hellwig wrote:
> On Wed, Nov 14, 2007 at 10:45:30AM +0100, Jens Axboe wrote:
> > > > size = ncpus * sizeof(struct thread_information);
> > > > thread_information = malloc(size * ndevs);
> > > > + memset(thread_information, 0, size*ndevs);
> > > > if (!thread_information) {
> > > > fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
> > > > return 1;
> > >
> > > I'm pretty sure you want to make the memset after the NULL-pointer check. If
> > > malloc fails this is segfaulting too.
> >
> > Ehm that's indeed a good point, I'll check in a fix for that.
>
> Even better just use calloc..
I considered it, but it holds ndevs * ncpus * size, so I thought it was
cleaner to keep it as-is and just move the memset.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-11-14 9:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-28 10:53 blktrace segfault Aneesh Kumar K.V
2007-10-29 19:47 ` Jens Axboe
2007-11-14 9:39 ` Jan Blunck
2007-11-14 9:45 ` Jens Axboe
2007-11-14 9:51 ` Christoph Hellwig
2007-11-14 9:53 ` Jens Axboe
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).