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

Re: #warning "Consider adding the right clone() syscall definitions here!"



Hi,

On 25/04/17 11:21, Mathieu Malaterre wrote:
> Hi there,
> 
> Did anyone review the warning(s) generated during systemd building on mipsel* ?
> 
> I am starring at the clone warning (mmap seems to trigger something
> equivalent apparently):
> 
> https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=mips64el&ver=232-22&stamp=1490743348&raw=0
> 
> See:
> http://sources.debian.net/src/systemd/232-22/src/shared/seccomp-util.c/#L726
> 
> 
> $ man 2 clone
> [...]
>        On x86-32, and several other common architectures (including
> score, ARM, ARM 64, PA-RISC, arc, Power PC, xtensa, and MIPS), the
> order of the last two arguments is reversed:
> 
>            long clone(unsigned long flags, void *child_stack,
>                      int *ptid, unsigned long newtls,
>                      int *ctid);
> [...]
> 
> Is this worth reporting a bug for this ?

Yes I think so.

Looking at the kernel, all current arches use the "normal" ordering of
the first 2 args except for cris and s390 (only CLONE_BACKWARDS2 is
relevant here).

$ grep CLONE_BACKWARDS arch/*/Kconfig
arch/arc/Kconfig:       select CLONE_BACKWARDS
arch/arm/Kconfig:       select CLONE_BACKWARDS
arch/arm64/Kconfig:     select CLONE_BACKWARDS
arch/cris/Kconfig:      select CLONE_BACKWARDS2
arch/microblaze/Kconfig:        select CLONE_BACKWARDS3
arch/mips/Kconfig:      select CLONE_BACKWARDS
arch/parisc/Kconfig:    select CLONE_BACKWARDS
arch/powerpc/Kconfig:   select CLONE_BACKWARDS
arch/s390/Kconfig:      select CLONE_BACKWARDS2
arch/score/Kconfig:     select CLONE_BACKWARDS
arch/x86/Kconfig:       select CLONE_BACKWARDS
arch/xtensa/Kconfig:    select CLONE_BACKWARDS

=== From kernel/fork.c ===
#ifdef CONFIG_CLONE_BACKWARDS
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
                 int __user *, parent_tidptr,
                 unsigned long, tls,
                 int __user *, child_tidptr)
#elif defined(CONFIG_CLONE_BACKWARDS2)
SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags,
                 int __user *, parent_tidptr,
                 int __user *, child_tidptr,
                 unsigned long, tls)
#elif defined(CONFIG_CLONE_BACKWARDS3)
SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp,
                int, stack_size,
                int __user *, parent_tidptr,
                int __user *, child_tidptr,
                unsigned long, tls)
#else
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
                 int __user *, parent_tidptr,
                 int __user *, child_tidptr,
                 unsigned long, tls)
#endif

Thanks,
James

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: