[2/2] fix risc64 user_regs_struct conflict with kernel header

Submitted by Baruch Siach on Aug. 6, 2019, 5:51 a.m.

Details

Message ID def2fa340038c0de0fd604db530d4b94b8121038.1565070674.git.baruch@tkos.co.il
State New
Series "Series without cover letter"
Headers show

Commit Message

Baruch Siach Aug. 6, 2019, 5:51 a.m.
Rename user_regs_struct following the example of s390 to avoid conflict
with the kernel asm/ptrace.h header.
---
 arch/riscv64/bits/user.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
index bd0f0fc7027f..097c7ad6ce18 100644
--- a/arch/riscv64/bits/user.h
+++ b/arch/riscv64/bits/user.h
@@ -1,4 +1,4 @@ 
-struct user_regs_struct {
+struct _user_regs_struct {
 	unsigned long pc;
 	unsigned long ra;
 	unsigned long sp;

Comments

Rich Felker Aug. 6, 2019, 12:10 p.m.
On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> Rename user_regs_struct following the example of s390 to avoid conflict
> with the kernel asm/ptrace.h header.
> ---
>  arch/riscv64/bits/user.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
> index bd0f0fc7027f..097c7ad6ce18 100644
> --- a/arch/riscv64/bits/user.h
> +++ b/arch/riscv64/bits/user.h
> @@ -1,4 +1,4 @@
> -struct user_regs_struct {
> +struct _user_regs_struct {
>  	unsigned long pc;
>  	unsigned long ra;
>  	unsigned long sp;
> -- 
> 2.20.1

Does this agree with glibc naming?

Rich
Baruch Siach Aug. 6, 2019, 12:15 p.m.
Hi Rick,

On Tue, Aug 06 2019, Rich Felker wrote:
> On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
>> Rename user_regs_struct following the example of s390 to avoid conflict
>> with the kernel asm/ptrace.h header.
>> ---
>>  arch/riscv64/bits/user.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
>> index bd0f0fc7027f..097c7ad6ce18 100644
>> --- a/arch/riscv64/bits/user.h
>> +++ b/arch/riscv64/bits/user.h
>> @@ -1,4 +1,4 @@
>> -struct user_regs_struct {
>> +struct _user_regs_struct {
>>  	unsigned long pc;
>>  	unsigned long ra;
>>  	unsigned long sp;
>
> Does this agree with glibc naming?

glibc riscv headers do not define user_regs_struct.

baruch
Rich Felker Aug. 6, 2019, 1:01 p.m.
On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> Hi Rick,
> 
> On Tue, Aug 06 2019, Rich Felker wrote:
> > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> >> Rename user_regs_struct following the example of s390 to avoid conflict
> >> with the kernel asm/ptrace.h header.
> >> ---
> >>  arch/riscv64/bits/user.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
> >> index bd0f0fc7027f..097c7ad6ce18 100644
> >> --- a/arch/riscv64/bits/user.h
> >> +++ b/arch/riscv64/bits/user.h
> >> @@ -1,4 +1,4 @@
> >> -struct user_regs_struct {
> >> +struct _user_regs_struct {
> >>  	unsigned long pc;
> >>  	unsigned long ra;
> >>  	unsigned long sp;
> >
> > Does this agree with glibc naming?
> 
> glibc riscv headers do not define user_regs_struct.

Not even by including a kernel header that defines it? If so, then the
public type must be the same as the type in the kernel header. This is
a known issue in user.h and related headers on several archs, and it's
hard to solve in any reasonable and consistent way short of doing the
same thing (including the kernel header). Renaming the type in a way
that makes the API incompatible is not the right solution.

Rich
Szabolcs Nagy Aug. 6, 2019, 1:16 p.m.
* Rich Felker <dalias@libc.org> [2019-08-06 09:01:29 -0400]:
> On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> > On Tue, Aug 06 2019, Rich Felker wrote:
> > > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> > >> -struct user_regs_struct {
> > >> +struct _user_regs_struct {
> > >
> > > Does this agree with glibc naming?
> > 
> > glibc riscv headers do not define user_regs_struct.
> 
> Not even by including a kernel header that defines it? If so, then the

the glibc sys/user.h is empty on riscv.

user_regs_struct is declared in asm/ptrace.h in linux
but that's not included into libc headers on riscv.

i think musl's user.h should be empty too.
Rich Felker Aug. 6, 2019, 2:04 p.m.
On Tue, Aug 06, 2019 at 03:16:03PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2019-08-06 09:01:29 -0400]:
> > On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> > > On Tue, Aug 06 2019, Rich Felker wrote:
> > > > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> > > >> -struct user_regs_struct {
> > > >> +struct _user_regs_struct {
> > > >
> > > > Does this agree with glibc naming?
> > > 
> > > glibc riscv headers do not define user_regs_struct.
> > 
> > Not even by including a kernel header that defines it? If so, then the
> 
> the glibc sys/user.h is empty on riscv.
> 
> user_regs_struct is declared in asm/ptrace.h in linux
> but that's not included into libc headers on riscv.
> 
> i think musl's user.h should be empty too.

Good news for once! That's even better.

Rich