* [PATCH] um: use POSIX ucontext_t instead of struct ucontext
@ 2017-11-15 10:12 Krzysztof Mazur
2017-11-15 10:19 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Mazur @ 2017-11-15 10:12 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
user-mode-linux-devel, linux-kernel, Krzysztof Mazur
glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
and break programs, including User Mode Linux. Fix User Mode Linux
by using POSIX ucontext_t.
This fixes:
arch/um/os-Linux/signal.c: In function 'hard_handler':
arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to incomplete type 'struct ucontext'
mcontext_t *mc = &uc->uc_mcontext;
arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to incomplete type 'struct ucontext'
&uc->uc_mcontext);
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
Tested only on x86.
arch/um/os-Linux/signal.c | 2 +-
arch/x86/um/stub_segv.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index a86d7cc2c2d8..a5c0c909c48b 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -159,7 +159,7 @@ static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {
static void hard_handler(int sig, siginfo_t *si, void *p)
{
- struct ucontext *uc = p;
+ ucontext_t *uc = p;
mcontext_t *mc = &uc->uc_mcontext;
unsigned long pending = 1UL << sig;
diff --git a/arch/x86/um/stub_segv.c b/arch/x86/um/stub_segv.c
index 1518d2805ae8..fd6825537b97 100644
--- a/arch/x86/um/stub_segv.c
+++ b/arch/x86/um/stub_segv.c
@@ -10,7 +10,7 @@
void __attribute__ ((__section__ (".__syscall_stub")))
stub_segv_handler(int sig, siginfo_t *info, void *p)
{
- struct ucontext *uc = p;
+ ucontext_t *uc = p;
GET_FAULTINFO_FROM_MC(*((struct faultinfo *) STUB_DATA),
&uc->uc_mcontext);
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] um: use POSIX ucontext_t instead of struct ucontext
2017-11-15 10:12 [PATCH] um: use POSIX ucontext_t instead of struct ucontext Krzysztof Mazur
@ 2017-11-15 10:19 ` Richard Weinberger
2017-11-15 11:04 ` Krzysztof Mazur
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2017-11-15 10:19 UTC (permalink / raw)
To: Krzysztof Mazur
Cc: Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
user-mode-linux-devel, linux-kernel
Am Mittwoch, 15. November 2017, 11:12:39 CET schrieb Krzysztof Mazur:
> glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
> and break programs, including User Mode Linux. Fix User Mode Linux
> by using POSIX ucontext_t.
>
> This fixes:
>
> arch/um/os-Linux/signal.c: In function 'hard_handler':
> arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to incomplete
> type 'struct ucontext' mcontext_t *mc = &uc->uc_mcontext;
> arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
> arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to incomplete
> type 'struct ucontext' &uc->uc_mcontext);
Do all older glibcs have ucontext_t?
Otherwise this patch will break other stuff.
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] um: use POSIX ucontext_t instead of struct ucontext
2017-11-15 10:19 ` Richard Weinberger
@ 2017-11-15 11:04 ` Krzysztof Mazur
2017-11-15 11:15 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Mazur @ 2017-11-15 11:04 UTC (permalink / raw)
To: Richard Weinberger
Cc: Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
user-mode-linux-devel, linux-kernel
On Wed, Nov 15, 2017 at 11:19:41AM +0100, Richard Weinberger wrote:
> Am Mittwoch, 15. November 2017, 11:12:39 CET schrieb Krzysztof Mazur:
> > glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
> > and break programs, including User Mode Linux. Fix User Mode Linux
> > by using POSIX ucontext_t.
> >
> > This fixes:
> >
> > arch/um/os-Linux/signal.c: In function 'hard_handler':
> > arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to incomplete
> > type 'struct ucontext' mcontext_t *mc = &uc->uc_mcontext;
> > arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
> > arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to incomplete
> > type 'struct ucontext' &uc->uc_mcontext);
>
> Do all older glibcs have ucontext_t?
> Otherwise this patch will break other stuff.
Yes, ucontext_t typedef was always available. They changed:
typedef struct ucontext { ... } ucontex_t;
to
typedef struct ucontext_t { ... } ucontex_t;
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27struct_ucontext.27
Thanks,
Krzysiek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] um: use POSIX ucontext_t instead of struct ucontext
2017-11-15 11:04 ` Krzysztof Mazur
@ 2017-11-15 11:15 ` Richard Weinberger
2017-11-15 11:22 ` Krzysztof Mazur
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2017-11-15 11:15 UTC (permalink / raw)
To: Krzysztof Mazur
Cc: Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
user-mode-linux-devel, linux-kernel
Am Mittwoch, 15. November 2017, 12:04:16 CET schrieb Krzysztof Mazur:
> On Wed, Nov 15, 2017 at 11:19:41AM +0100, Richard Weinberger wrote:
> > Am Mittwoch, 15. November 2017, 11:12:39 CET schrieb Krzysztof Mazur:
> > > glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
> > > and break programs, including User Mode Linux. Fix User Mode Linux
> > > by using POSIX ucontext_t.
> > >
> > > This fixes:
> > >
> > > arch/um/os-Linux/signal.c: In function 'hard_handler':
> > > arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to
> > > incomplete type 'struct ucontext' mcontext_t *mc = &uc->uc_mcontext;
> > > arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
> > > arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to
> > > incomplete
> > > type 'struct ucontext' &uc->uc_mcontext);
> >
> > Do all older glibcs have ucontext_t?
> > Otherwise this patch will break other stuff.
>
> Yes, ucontext_t typedef was always available. They changed:
>
> typedef struct ucontext { ... } ucontex_t;
>
> to
>
> typedef struct ucontext_t { ... } ucontex_t;
>
> https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27struct_ucontext
> .27
Okay, then we can mark your patch as stable and hope for the best. ;-)
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] um: use POSIX ucontext_t instead of struct ucontext
2017-11-15 11:15 ` Richard Weinberger
@ 2017-11-15 11:22 ` Krzysztof Mazur
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Mazur @ 2017-11-15 11:22 UTC (permalink / raw)
To: Richard Weinberger
Cc: Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
user-mode-linux-devel, linux-kernel
On Wed, Nov 15, 2017 at 12:15:00PM +0100, Richard Weinberger wrote:
> Am Mittwoch, 15. November 2017, 12:04:16 CET schrieb Krzysztof Mazur:
> > On Wed, Nov 15, 2017 at 11:19:41AM +0100, Richard Weinberger wrote:
> > > Am Mittwoch, 15. November 2017, 11:12:39 CET schrieb Krzysztof Mazur:
> > > > glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance
> > > > and break programs, including User Mode Linux. Fix User Mode Linux
> > > > by using POSIX ucontext_t.
> > > >
> > > > This fixes:
> > > >
> > > > arch/um/os-Linux/signal.c: In function 'hard_handler':
> > > > arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to
> > > > incomplete type 'struct ucontext' mcontext_t *mc = &uc->uc_mcontext;
> > > > arch/x86/um/stub_segv.c: In function 'stub_segv_handler':
> > > > arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to
> > > > incomplete
> > > > type 'struct ucontext' &uc->uc_mcontext);
> > >
> > > Do all older glibcs have ucontext_t?
> > > Otherwise this patch will break other stuff.
> >
> > Yes, ucontext_t typedef was always available. They changed:
> >
> > typedef struct ucontext { ... } ucontex_t;
> >
> > to
> >
> > typedef struct ucontext_t { ... } ucontex_t;
> >
> > https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27struct_ucontext
> > .27
>
> Okay, then we can mark your patch as stable and hope for the best. ;-)
Thanks
Krzysiek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-15 11:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15 10:12 [PATCH] um: use POSIX ucontext_t instead of struct ucontext Krzysztof Mazur
2017-11-15 10:19 ` Richard Weinberger
2017-11-15 11:04 ` Krzysztof Mazur
2017-11-15 11:15 ` Richard Weinberger
2017-11-15 11:22 ` Krzysztof Mazur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox