From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by sourceware.org (Postfix) with ESMTPS id A92DC385840F for ; Thu, 25 May 2023 17:36:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A92DC385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5555a3266cbso416141eaf.1 for ; Thu, 25 May 2023 10:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685036201; x=1687628201; h=content-transfer-encoding:in-reply-to:organization:references:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=n/vS4DrdaCdDzKJ2zgEtVHdLnntu+T4PNrJTsEZjOrE=; b=f9D4fQwZ1wiwnepxG2Rr/jxyg5ZBIrSlSHS/icfmv8REh0RAnmeY8MaZxQvStVYi4Q /CsSGDsTMRlw8uN/cqP6HPaDqaMHJPp7uyZ96CNesx26rhjlu6xDGc7yNVm9huNoHrI1 AYJwKPECPioBuqG8fsfZlMzwKPW+1kUOK+1IyG40J+6SoC4fLfSER9gT4+Hxn6sNrjhd R/vL4OqGMkxjNXUgVTyAmMZ6TCEgQYfQqecEwGF7JZ6Ko6aRIPYmyfuzhFaJCynoKz4x 8Av+tWCnPJlRW9nGpQ37i1MJYNUulwYsmViHOyqYbw4mU7tQm6mXQOe9BbCfNcU4bmNG KJww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685036201; x=1687628201; h=content-transfer-encoding:in-reply-to:organization:references:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n/vS4DrdaCdDzKJ2zgEtVHdLnntu+T4PNrJTsEZjOrE=; b=kXYRd/yQZ5mdOTF5taH0Kp8iDmnVIkPizGlt6XmfG3TkDUL9nW9imu42pgnrYK0FMj AZI4jW3Ad0MuJIUI5BIEONjRTPD0GrDDfG5ncr7noX8vU8lh3AVqoITcJGAm5+u8Y2EV SyWJWu+zphUbV4EGCnmUMtorW+LV+w2sYSKni5QfJSuHG3W+cPOXatDDNUIiKpHLfBZP 7wz+giU7PkydbjQhYNVG70XBPmcvCWFKmJpWPeAowfC7q4XeJa9PnMiAthgojPMBTyAQ VcmKaAprbuMQ8T2iXBzGv5dfvSW3xYUGrjyZu8OHD4wavmedNaKQKY1XdvpB3NxhD3/3 zr0A== X-Gm-Message-State: AC+VfDwyipLHHs2nc+jayylAsYV0zAHUGrqDsvxDxPxX8x2YZyoGvUve NVGVHwbYM6ldtg8x35Ssx9vo6quOw2nxirebE18zmg== X-Google-Smtp-Source: ACHHUZ7tmcXgT6MLuHMfaSJL2caivsZeGRbz0w8mT+ScoronLXAv7a2BdWT5cKLjr2fbcrqSPMhwkA== X-Received: by 2002:a4a:9b81:0:b0:552:4a83:6e7d with SMTP id x1-20020a4a9b81000000b005524a836e7dmr10473138ooj.7.1685036201486; Thu, 25 May 2023 10:36:41 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:4dd5:80c6:51f7:4cf7:20d3? ([2804:1b3:a7c1:4dd5:80c6:51f7:4cf7:20d3]) by smtp.gmail.com with ESMTPSA id t6-20020a4aa3c6000000b0051134f333d3sm643851ool.16.2023.05.25.10.36.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 10:36:40 -0700 (PDT) Message-ID: <21db8fa4-c173-27d6-d0ab-2ce2d0258eb8@linaro.org> Date: Thu, 25 May 2023 14:36:38 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.1 Subject: Re: [PATCH 4/5] arm: Add the clone3 wrapper Content-Language: en-US From: Adhemerval Zanella Netto To: libc-alpha@sourceware.org References: <20230203171237.1220878-1-adhemerval.zanella@linaro.org> <20230203171237.1220878-5-adhemerval.zanella@linaro.org> Organization: Linaro In-Reply-To: <20230203171237.1220878-5-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,KAM_STOCKGEN,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Ping. On 03/02/23 14:12, Adhemerval Zanella wrote: > It follows the internal signature: > > extern int clone3 (struct clone_args *__cl_args, size_t __size, > int (*__func) (void *__arg), void *__arg); > > Checked on arm-linux-gnueabihf. > --- > sysdeps/unix/sysv/linux/arm/clone3.S | 80 ++++++++++++++++++++++++++++ > sysdeps/unix/sysv/linux/arm/sysdep.h | 1 + > 2 files changed, 81 insertions(+) > create mode 100644 sysdeps/unix/sysv/linux/arm/clone3.S > > diff --git a/sysdeps/unix/sysv/linux/arm/clone3.S b/sysdeps/unix/sysv/linux/arm/clone3.S > new file mode 100644 > index 0000000000..f236d18390 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/arm/clone3.S > @@ -0,0 +1,80 @@ > +/* The clone3 syscall wrapper. Linux/arm version. > + Copyright (C) 2023 Free Software Foundation, Inc. > + > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#define _ERRNO_H 1 > +#include > + > +/* The userland implementation is: > + int clone3 (struct clone_args *cl_args, size_t size, > + int (*func)(void *arg), void *arg); > + > + the kernel entry is: > + int clone3 (struct clone_args *cl_args, size_t size); > + > + The parameters are passed in registers from userland: > + r0: cl_args > + r1: size > + r2: func > + r3: arg */ > + > + .text > +ENTRY(__clone3) > + /* Sanity check args. */ > + cmp r0, #0 > + ite ne > + cmpne r1, #0 > + moveq r0, #-EINVAL > + beq PLTJMP(syscall_error) > + > + /* Do the syscall, the kernel expects: > + r7: system call number: > + r0: cl_args > + r1: size */ > + push { r7 } > + cfi_adjust_cfa_offset (4) > + cfi_rel_offset (r7, 0) > + ldr r7, =SYS_ify(clone3) > + swi 0x0 > + cfi_endproc > + > + cmp r0, #0 > + beq 1f > + pop {r7} > + blt PLTJMP(C_SYMBOL_NAME(__syscall_error)) > + RETINSTR(, lr) > + > + cfi_startproc > +PSEUDO_END (__clone3) > + > +1: > + .fnstart > + .cantunwind > + mov r0, r3 > + mov ip, r2 > + BLX (ip) > + > + /* And we are done, passing the return value through r0. */ > + ldr r7, =SYS_ify(exit) > + swi 0x0 > + > + .fnend > + > +libc_hidden_def (__clone3) > +weak_alias (__clone3, clone3) > diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h > index 2f321881c8..57fc5f16bd 100644 > --- a/sysdeps/unix/sysv/linux/arm/sysdep.h > +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h > @@ -362,6 +362,7 @@ __local_syscall_error: \ > #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" > #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64" > #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" > +#define HAVE_CLONE3_WRAPPER 1 > > #define LOAD_ARGS_0() > #define ASM_ARGS_0