Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 20 Apr 2022 17:09:08 +0800
From: 王洪亮 <wanghongliang@...ngson.cn>
To: musl@...ts.openwall.com, Christian Brauner <brauner@...nel.org>
Subject: Re: Re: add loongarch64 port


在 2022/4/14 下午5:36, Christian Brauner 写道:
> On Wed, Apr 13, 2022 at 10:09:31AM -0400, Rich Felker wrote:
>> On Wed, Apr 13, 2022 at 03:25:05PM +0200, Arnd Bergmann wrote:
>>> On Wed, Apr 13, 2022 at 11:04 AM Christian Brauner <brauner@...nel.org> wrote:
>>>> On Wed, Apr 13, 2022 at 10:26:06AM +0200, Arnd Bergmann wrote:
>>>>> The normal rule is that we don't define obsolete system calls in new
>>>>> architectures when an improved variant has been added, e.g. oldoldstat,
>>>>> oldstat, stat, newstat and stat64 have all been replaced by statx over
>>>>> the decades. I was expecting the same to be true for clone(), but if
>>>>> clone3() is not meant as a replacement, we can keep both around.
>>>> No, I agree with you on this and would like to only implement clone3()
>>>> on new architectures.
>>>>
>>>> What I'm asking is whether removing the size == 0 check is enough to
>>>> unblock the missing behavior and whether you'd be on board with removing
>>>> the check?
>>> I think that's ok here, since we'd only rely on this for loongarch64 at the
>>> moment. It would probably need to be documented in the man page
>>> as a special case though.
>> I'm okay with removing the check for size==0 (so size==0 will be
>> allowed) and dropping __NR_clone on new archs, as long as it's noted
>> in comments/documentation that size==0 is explicitly allowed so nobody
>> breaks this in the future.
> Ok, I'll try to have a patch ready early next week since I'm currently
> out sick.

Hi,

I'm implementing  __NR_clone3 syscall within __clone().

I have another problem:CLONE_DETACHED

in musl,internal call __clone()(such as __pthread_create()),the input 
parameter flags

has been set CLONE_DETACHED ,in kernel,there is a check in 
clone3_args_valid(),

if the condition met,return false.

How to deal with this problem?

src/thread/pthread_create.c:
int __pthread_create(pthread_t *restrict res, const pthread_attr_t 
*restrict attrp,
                                 void *(*entry)(void *), void *restrict arg)
{
     unsigned flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND
     | CLONE_THREAD | CLONE_SYSVSEM | CLONE_SETTLS
     | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | CLONE_DETACHED;
     ...
     ret = __clone((c11 ? start_c11 : start), stack, flags, args, 
&new->tid,
                             TP_ADJ(new), &__thread_list_lock);
}

kernel/fork.c:
static bool clone3_args_valid(struct kernel_clone_args *kargs)
{
          /*
           * - make the CLONE_DETACHED bit reusable for clone3
           * - make the CSIGNAL bits reusable for clone3
           */
          if (kargs->flags & (CLONE_DETACHED | CSIGNAL))
                  return false;
}


Hongliang Wang

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.