trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix off-by-one in dump_childnos()
@ 2017-04-16 18:29 Tommi Rantala
  2017-04-16 18:34 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Tommi Rantala @ 2017-04-16 18:29 UTC (permalink / raw)
  To: davej; +Cc: trinity, Tommi Rantala

Fixes a segfault:

  ## pids: (60 active)
  0-7: 0 0 0 0 0 0 0 0
  8-15: 0 0 0 0 0 0 0 0
  16-23: 0 0 0 0 0 0 0 0
  24-31: 0 0 0 0 0 0 0 0
  32-39: 0 11081 11082 11083 11084 11085 11086 11087
  40-47: 11088 11089 11090 11091 11093 11094 11095 11096
  48-55: 11097 11098 11099 11100 11101 11102 0 0
  Segmentation fault
---
 pids.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pids.c b/pids.c
index 8b77e2f..1a23284 100644
--- a/pids.c
+++ b/pids.c
@@ -82,7 +82,7 @@ void dump_childnos(void)
 		for (j = 0; j < 8; j++) {
 			struct childdata *child;
 
-			if (i + j > max_children)
+			if (i + j >= max_children)
 				break;
 
 			child = shm->children[i + j];
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix off-by-one in dump_childnos()
  2017-04-16 18:29 [PATCH] fix off-by-one in dump_childnos() Tommi Rantala
@ 2017-04-16 18:34 ` Dave Jones
  2017-04-16 19:35   ` Tommi Rantala
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2017-04-16 18:34 UTC (permalink / raw)
  To: Tommi Rantala; +Cc: trinity

On Sun, Apr 16, 2017 at 09:29:14PM +0300, Tommi Rantala wrote:
 > Fixes a segfault:
 > 
 >   ## pids: (60 active)
 >   0-7: 0 0 0 0 0 0 0 0
 >   8-15: 0 0 0 0 0 0 0 0
 >   16-23: 0 0 0 0 0 0 0 0
 >   24-31: 0 0 0 0 0 0 0 0
 >   32-39: 0 11081 11082 11083 11084 11085 11086 11087
 >   40-47: 11088 11089 11090 11091 11093 11094 11095 11096
 >   48-55: 11097 11098 11099 11100 11101 11102 0 0
 >   Segmentation fault

Applied.  If you're seeing that though, that's indicative of a bigger
problem (that we corrupted the pid table, or lost track of a child proc.).
I've not seen that happen in about a year, does it happen often for you?

	Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix off-by-one in dump_childnos()
  2017-04-16 18:34 ` Dave Jones
@ 2017-04-16 19:35   ` Tommi Rantala
  0 siblings, 0 replies; 3+ messages in thread
From: Tommi Rantala @ 2017-04-16 19:35 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity

2017-04-16 21:34 GMT+03:00 Dave Jones <davej@codemonkey.org.uk>:
> On Sun, Apr 16, 2017 at 09:29:14PM +0300, Tommi Rantala wrote:
>  > Fixes a segfault:
>  >
>  >   ## pids: (60 active)
>  >   0-7: 0 0 0 0 0 0 0 0
>  >   8-15: 0 0 0 0 0 0 0 0
>  >   16-23: 0 0 0 0 0 0 0 0
>  >   24-31: 0 0 0 0 0 0 0 0
>  >   32-39: 0 11081 11082 11083 11084 11085 11086 11087
>  >   40-47: 11088 11089 11090 11091 11093 11094 11095 11096
>  >   48-55: 11097 11098 11099 11100 11101 11102 0 0
>  >   Segmentation fault
>
> Applied.  If you're seeing that though, that's indicative of a bigger
> problem (that we corrupted the pid table, or lost track of a child proc.).

Yea, I believe it was just about to exit anyways after the debug output.

> I've not seen that happen in about a year, does it happen often for you?

I was testing trinity in some minimal busybox & qemu environment, and
saw it a few times.
Now that I try it again, cannot reproduce the segfault anymore...

All the trinity processes have read-write access to the pids[] array?
So any one of them could corrupt the memory...?

-Tommi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-16 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-16 18:29 [PATCH] fix off-by-one in dump_childnos() Tommi Rantala
2017-04-16 18:34 ` Dave Jones
2017-04-16 19:35   ` Tommi Rantala

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).