public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: unassigned@bugs.ecos.sourceware.org
Subject: [Bug 1001522] Array index out of bounds in tftp_server.c
Date: Mon, 12 Mar 2012 14:32:00 -0000	[thread overview]
Message-ID: <20120312143205.CDBD12F78001@mail.ecoscentric.com> (raw)
In-Reply-To: <bug-1001522-777@http.bugs.ecos.sourceware.org/>

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001522

--- Comment #8 from Grant Edwards <grant.b.edwards@gmail.com> 2012-03-12 14:31:57 GMT ---
(In reply to comment #7)
> (In reply to comment #6)


>>> Oh true. Yes you have to close them all _except_ the one that
>>> matched select.
>> 
>> Then you can have parallel operations only when requests are coming in
>> simultaneously on different protocols.
> 
> Well, my idea was (theoretically) that you could still open a new
> socket while still using the previous one to talk to the remote
> host.

Ah.  I had assumed that wasn't possible (and that's why the sockets
were being closed in the first place).


>>> But maybe a good enough solution which isn't too far from current
>>> is to make the socket non-blocking, and just get threads to loop
>>> back to the select if they wake up and there's no data after all
>>> (recvfrom() returns -1 with errno set to EWOULDBLOCK).
>> 
>> That's probably the easiest way to fix the port-unreachable
>> problem, but it does have the overhead of waking all the threads
>> for every packet.
> 
> I think that's a small price to pay. Most likely the number of
> threads would be very small anyway.

True.  Efficient but broken is a bit of false economy.

> > Another solution that occurred to me is to have a set of threads for
> > each socket (IOW for each protocol).  Leave the sockets blocking and
> > keep them open the whole time.  All the threads make blocking read
> > calls, and only one wakes up for each packet.  It's all nice and
> > simple, but you need more thread instances _if_ ipv6 is enabled.
> 
> That's not too bad. Although the code may get messy when still retaining the
> non-multi-threaded case. But it this was implemented, it wouldn't be a huge
> deal to insist in CDL that the number of threads is an even number if ipv6 is
> enabled (in the multi-threaded case i.e. >1 ). Or even have the user set the
> number of ipv4 threads and ipv6 threads separately.

Right.  I had assumed that the minimal case would be one thread per
socket (protocol) -- the thread code would be the same for all cases
(do a blocking read and handle the received packet).  How the threads
are apportioned amongst the protocols would be an new question.
Letting the user set the number of threads for each protcol would
probably be the simplest.

> I think I would prefer the non-blocking socket and blocking select()
> option though as IMO the overall penalty for waking multiple threads
> unnecessarily occasionally is much less than the overall penalty of
> having extra threads around unused.

Compared to the pool-per-socket idea, that approach doesn't require
any CDL changes and would be more transparent to current users, so it
sounds like the best option.

-- 
Grant

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


  parent reply	other threads:[~2012-03-12 14:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 15:43 [Bug 1001522] New: " bugzilla-daemon
2012-03-09  5:09 ` [Bug 1001522] " bugzilla-daemon
2012-03-09  5:13 ` bugzilla-daemon
2012-03-09 15:55 ` bugzilla-daemon
2012-03-09 16:12 ` bugzilla-daemon
2012-03-09 16:32 ` bugzilla-daemon
2012-03-09 17:39 ` bugzilla-daemon
2012-03-11  3:56 ` bugzilla-daemon
2012-03-12 14:32 ` bugzilla-daemon [this message]
2012-08-09 16:05 ` bugzilla-daemon
2012-08-09 16:27 ` bugzilla-daemon
2012-08-09 17:02 ` bugzilla-daemon
2012-08-09 17:34 ` bugzilla-daemon
2012-08-10  9:57 ` bugzilla-daemon
2012-08-10 10:16 ` bugzilla-daemon
2012-03-07 15:43 [Bug 1001522] New: " bugzilla-daemon
2012-03-09  5:09 ` [Bug 1001522] " bugzilla-daemon
2012-03-09  5:13 ` bugzilla-daemon
2012-03-09 15:55 ` bugzilla-daemon
2012-03-09 16:12 ` bugzilla-daemon
2012-03-09 16:32 ` bugzilla-daemon
2012-03-09 17:39 ` bugzilla-daemon
2012-03-11  3:56 ` bugzilla-daemon
2012-03-12 14:32 ` bugzilla-daemon
2012-08-09 16:05 ` bugzilla-daemon
2012-08-09 16:28 ` bugzilla-daemon
2012-08-09 17:02 ` bugzilla-daemon
2012-08-09 17:34 ` bugzilla-daemon
2012-08-10  9:57 ` bugzilla-daemon
2012-08-10 10:16 ` bugzilla-daemon

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=20120312143205.CDBD12F78001@mail.ecoscentric.com \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=unassigned@bugs.ecos.sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).