Re: siginfo_t.si_addr should be void*
On Sat, Apr 1, 2017 at 10:03 PM, Andrew Aldridgewrote: > --- siginfo.h 14 Apr 2015 16:40:46 - 1.11 > +++ siginfo.h 29 Mar 2017 22:17:49 - > @@ -150,7 +150,7 @@ typedef struct { ... > - caddr_t _addr; /* faulting address */ > + void*_addr; /* faulting address */ Committed. Thanks! Philip Guenther
Re: siginfo_t.si_addr should be void*
On 2016-05-30 08:59, Martin Pieuchot wrote: On 27/04/16(Wed) 18:52, i80...@foxquill.com wrote: On 2016-04-27 18:20, Joerg Sonnenberger wrote: >This >[...snip...] >and this disagree? I... am so sorry. You're right of course; I don't know how that patch happened. ok mpi@ Regenerated the patch with CVS, now that I actually know how to use it a little bit: Index: siginfo.h === RCS file: /var/storage/andrew/openbsd/cvs/src/sys/sys/siginfo.h,v retrieving revision 1.11 diff -u -p -u -r1.11 siginfo.h --- siginfo.h 14 Apr 2015 16:40:46 - 1.11 +++ siginfo.h 29 Mar 2017 22:17:49 - @@ -150,7 +150,7 @@ typedef struct { } _pdata; } _proc; struct {/* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ - caddr_t _addr; /* faulting address */ + void*_addr; /* faulting address */ int _trapno;/* illegal trap number */ } _fault; #if 0 Thank you, Andrew Aldridge
Re: siginfo_t.si_addr should be void*
On 27/04/16(Wed) 18:52, i80...@foxquill.com wrote: > On 2016-04-27 18:20, Joerg Sonnenberger wrote: > >This > >[...snip...] > >and this disagree? > > I... am so sorry. You're right of course; I don't know how that patch > happened. ok mpi@ > diff --git a/src/sys/sys/siginfo.h b/src/sys/sys/siginfo.h > index 814e8f2..1e8365f 100644 > --- a/src/sys/sys/siginfo.h > +++ b/src/sys/sys/siginfo.h > @@ -150,7 +150,7 @@ typedef struct { > } _pdata; > } _proc; > struct {/* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ > - caddr_t _addr; /* faulting address */ > + void*_addr; /* faulting address */ > int _trapno;/* illegal trap number */ > } _fault; > #if 0 >
Re: siginfo_t.si_addr should be void*
Since si_addr is only assigned to inside the kernel this should be safe to change. - todd
Re: siginfo_t.si_addr should be void*
On 2016-04-27 18:20, Joerg Sonnenberger wrote: This [...snip...] and this disagree? I... am so sorry. You're right of course; I don't know how that patch happened. Correct patch: diff --git a/src/sys/sys/siginfo.h b/src/sys/sys/siginfo.h index 814e8f2..1e8365f 100644 --- a/src/sys/sys/siginfo.h +++ b/src/sys/sys/siginfo.h @@ -150,7 +150,7 @@ typedef struct { } _pdata; } _proc; struct {/* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ - caddr_t _addr; /* faulting address */ + void*_addr; /* faulting address */ int _trapno;/* illegal trap number */ } _fault; #if 0
Re: siginfo_t.si_addr should be void*
On Wed, Apr 27, 2016 at 06:04:32PM -0400, i80...@foxquill.com wrote: > POSIX specifies that siginfo_t.si_addr must be void*. OpenBSD currently > defines it as caddr_t. This breaks some userspace programs, such as the > following minimal case: This > The following patch builds the base system cleanly on x86_64, and > resolves the problem. > > diff --git a/src/sys/sys/siginfo.h b/src/sys/sys/siginfo.h > index 814e8f2..1e8365f 100644 > --- a/src/sys/sys/siginfo.h > +++ b/src/sys/sys/siginfo.h > @@ -150,7 +150,7 @@ typedef struct { > } _pdata; > } _proc; > struct {/* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ > - caddr_t _addr; /* faulting address */ > + char*_addr; /* faulting address */ > int _trapno;/* illegal trap number */ > } _fault; > #if 0 and this disagree? Joerg
siginfo_t.si_addr should be void*
POSIX specifies that siginfo_t.si_addr must be void*. OpenBSD currently defines it as caddr_t. This breaks some userspace programs, such as the following minimal case: #include #include void handler(int, siginfo_t *info, void*) { std::cout << "Foo" << info->si_addr << "bar\n"; } int main(int, char**) { struct sigaction action; action.sa_sigaction = handler; action.sa_flags = SA_SIGINFO; sigaction(SIGILL, , NULL); raise(SIGILL); return 0; } On OpenBSD, ostream will treat the char* si_addr as a C-string. Luckily it's NULL in this case, but it causes only "Foo" to be printed. No future uses of std::cout will result in output. The following patch builds the base system cleanly on x86_64, and resolves the problem. diff --git a/src/sys/sys/siginfo.h b/src/sys/sys/siginfo.h index 814e8f2..1e8365f 100644 --- a/src/sys/sys/siginfo.h +++ b/src/sys/sys/siginfo.h @@ -150,7 +150,7 @@ typedef struct { } _pdata; } _proc; struct {/* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ - caddr_t _addr; /* faulting address */ + char*_addr; /* faulting address */ int _trapno;/* illegal trap number */ } _fault; #if 0 -- Andrew Aldridge