From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id A93733858D20 for ; Thu, 10 Nov 2022 11:49:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A93733858D20 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-oi1-x22e.google.com with SMTP id v81so1552748oie.5 for ; Thu, 10 Nov 2022 03:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=rK6YEOnKN4Z8G1JoU7HjPhADXk5euKmrBNvRrUX42qk=; b=vTysSwqyySS3ANgSMl1Zr441p3UYZTLma9Ef3mLUdJ6MKF9tWvK2CqgGoI2Rtr9DuN FAQ80tOcD6zqwxzuqnw6wy/PWvFtNjalYmmnybl9SEFlW2EhJuRB/t4M0dqZOZeLShbT gYu+0UDQRC7zB9IY4ThJ5URuZIi19zAOPQ75Kj2B0Ke3AXxucXq+YSv/JvokzvIS+Kye sualS1OMP8n4efDDydr/bJwpTqDrEaiS6xU36H87xC4M54gb66yW+156rdrFSAbquG2Y OFZGFGGThfnfnHpGFR6sbPZDohNVxF2MTxM3qG9T4PtijhSzoEAbpqIAViS68rin+qQH AiWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rK6YEOnKN4Z8G1JoU7HjPhADXk5euKmrBNvRrUX42qk=; b=mxdXNPqBdKq2cZ1fM5hUut0CzUTOJfyDfW1hczHeuu6iuSVTudKj5P+JOgraOJqI1j 06EWgzL9vX0ip+4HQ0O35keKTZ9frFxKYuQjD4egcXkXcwOSoSwUOo/Ba+AOxuDsGax1 8YS51EnvBJ/5zP4IM4phbSqNXCzp+pGDyVvdVjJbqUATgOPLVA02tWAITAKEji1g8znb gUucgHsgK/CsIPlFOA7R2zV2juXiOVdsilf3gvbmXhp31hs2s7pc4f9MVd62NUb4+Pkj 8sBfe6amhff6r8cwyrs2JkqAGI/FMy0fOo56BvunUWegC7cRkAz2hmeWn5/eTggmiexS w3Qw== X-Gm-Message-State: ACrzQf3ZpzryMl8ffg6Iwka7ljDRQ/1npFglXcsGJEk28vd855HCwGab ZBtrW1rAv1roiuuCGQXOk/MEd/I9BBA3iunc X-Google-Smtp-Source: AMsMyM7/xKQ9A3wHSvJcXSq8mQAoiwmzD3heyg7tGah765F/ZTRlN8GJTluzr3DdjWsF6/YsjuXhzA== X-Received: by 2002:a05:6808:2189:b0:35a:58aa:91a5 with SMTP id be9-20020a056808218900b0035a58aa91a5mr18504551oib.82.1668080967926; Thu, 10 Nov 2022 03:49:27 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:1164:5982:d209:e8ed:b69a? ([2804:1b3:a7c1:1164:5982:d209:e8ed:b69a]) by smtp.gmail.com with ESMTPSA id x3-20020a056830278300b00661a33883b8sm6234988otu.71.2022.11.10.03.49.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Nov 2022 03:49:27 -0800 (PST) Message-ID: <183d6add-a82f-8d3e-6669-b5f9f78c2d45@linaro.org> Date: Thu, 10 Nov 2022 08:49:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: V3 [PATCH] Add a C wrapper for prctl [BZ #25896] Content-Language: en-US To: Florian Weimer , "H.J. Lu via Libc-alpha" Cc: Andreas Schwab , "H.J. Lu" References: <20200429205217.2435607-1-hjl.tools@gmail.com> <87wo5xa0yt.fsf@mid.deneb.enyo.de> <20200430130333.GA254612@gmail.com> <87h7x1gkfg.fsf@igel.home> <87mu6t84yg.fsf@mid.deneb.enyo.de> <87d07pgjz0.fsf@igel.home> <878sidgjcp.fsf@igel.home> <875yfnw6n6.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <875yfnw6n6.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: On 10/11/22 05:33, Florian Weimer via Libc-alpha wrote: > * H. J. Lu via Libc-alpha: > >> From ee8672af3ef5f3db438c0abb39b2673944181292 Mon Sep 17 00:00:00 2001 >> From: "H.J. Lu" >> Date: Wed, 29 Apr 2020 07:38:49 -0700 >> Subject: [PATCH] Add a C wrapper for prctl [BZ #25896] >> >> Add a C wrapper to pass arguments in >> >> /* Control process execution. */ >> extern int prctl (int __option, ...) __THROW; >> >> to prctl syscall: >> >> extern int prctl (int, unsigned long int, unsigned long int, >> unsigned long int, unsigned long int); >> >> On Linux/x86, since the prctl syscall interface: >> >> extern int prctl (int, unsigned long int, unsigned long int, >> unsigned long int, unsigned long int); >> >> and the glibc prctl interface: >> >> extern int prctl (int option, ...); >> >> pass the arguments identically, the assembly verion: >> >> PSEUDO (__prctl, prctl, 5) >> ret >> PSEUDO_END (__prctl) >> >> is used. > > This broke ABI on powerpc64le-linux-gnu because the calling convention > is not identical. The manual page specifies the second prototype. > > I filed a GCC RFE so that we can deal with this in a more elegant > manner: > > rs6000: Option not to use parameter save area in variadic function > implementations > > > I don't know whether we should restrict the C prctl wrapper to x86 x32, > or if we should add an assembler wrapper on powerpc64le-linux-gnu. > > Thanks, > Florian > The previous syscalls.list entry marked the function as 5 argument one instead of variadic, so I think it would be better to add a way each ABI to use this instead of the variadic one. Something like: #if PRCTL_VARIADIC_OK int __prctl (int option, ...) { va_list arg; va_start (arg, option); unsigned long int arg2 = va_arg (arg, unsigned long int); unsigned long int arg3 = va_arg (arg, unsigned long int); unsigned long int arg4 = va_arg (arg, unsigned long int); unsigned long int arg5 = va_arg (arg, unsigned long int); va_end (arg); return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5); } #else int __prctl (int option, int arg1, int arg2, int arg3, int arg4, int arg5) { return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5); } #endif Or if powerpc64le is the only affected add a specific C implementation for it. I think we should really move away from assembler wrappers.