Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/regress/lib/libc/siginfo/sigfpe



On Feb 18, 10:47pm, M.Drochner%fz-juelich.de@localhost (Matthias Drochner) 
wrote:
-- Subject: Re: CVS commit: src/regress/lib/libc/siginfo/sigfpe

| 
| christos%zoulas.com@localhost said:
| > This all started because if the SIGFPE's in a tight loop froze the
| > vax.
| 
| Ah yes, I see mhitch's mail.
| 
| > Programming with setjmp and longjmp is very difficult and
| > requires a lot of discipline to deal with memory allocation.
| 
| Agreed. But the SIGFPE case is somewhat special. A program
| doing real numerical computations wouldn't be able to continue
| after a fpe signal in a useful way - it will abort or start
| over with changed parameters.
| What we have to deal with are kind of meta-programs as
| regression tests, interpreters, or lint(1) which is also
| an interpreter at that point. Here we know at which
| points suspicious code is executed, and can make sure
| that the signal handler is only invoked where we allow.
| 
| I haven't seen any portable code which tries to return
| from a SIGFPE by just a "return". In particular Python which
| is certainly exercised a lot in different environments
| does a longjmp from its sigfpe handler.

Even that is not guaranteed to work.

| So I'd suggest to make lint(1) more conservative, which
| should not be that hard because everything happens just
| in the foldflt() function -- either do some setjmp/longjmp
| just in this function, or just test the sticky flags
| which would avoid signals completely.

I can certainly do that.

| > I just want to add the ability to do/control this in all archs in a sane
| > way.
| 
| I think this is a game we can't win. As Joerg said it might require
| opcode interpretation in the kernel trap handler. Look at
| the alpha fp completion code...

Yes, we have that in ddb, and we do opcode interpretation in many
archs already for instruction emulations and misalignment support.
The cost is just more code, but I think that it is useful to have
this feature instead of say "behavior undefined" like the standard
says.

christos


Home | Main Index | Thread Index | Old Index