From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C405D3B8D6F for ; Mon, 8 Dec 2025 11:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765194454; cv=none; b=l5kdDv3JbygHI5pcMFcU0YbKe/QTP4ZTkEqtHOylH/GMeDc7KtHlV9lh3cjYzFu8U+DIorCSkB7mPg1fnQvgmTsDGo6GJlT5kEVHpBT65PNHqW+3XgvJN9VQtlcpz48Vbfe4vsf0c2JhJabywZCzXnxyqGiqzTpyDWHtllCN5zw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765194454; c=relaxed/simple; bh=cPjCAv+h705LWGeysdsVNGtcKLwFHq/UmtGoZbphSjw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IDwB0ES/mO3qWb377KaA0yV3sjVXoHJpRuqGBK5ci+ItknDILpDxphR0wLX7TqR0iTNtJUpw6wHFFXZc2xMMY/X476zC2EuXIbSeIrmTcRd8L+n63SJlJWQ2eaoXv24DRf3C9yUKdankIqLpnPg+geZF75ZF/xyV+RP0mzDJjTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YokivWQd; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YokivWQd" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-bd1b0e2c1eeso3443432a12.0 for ; Mon, 08 Dec 2025 03:47:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765194452; x=1765799252; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=4okenSK+FWacRX0/UFto8Btvp96AOr1jENqIpaAT3Xo=; b=YokivWQd3p62UPHSnJdybDPuyFwLeIqAHoEag+gd4dwvtD7NIqIy0a7CGn6K7lgXzn QJCYMg+AU6JPVjRTjqh6CNIC1fPTHfRa42zabMVF8MTbko5kH+RcC7mGmY2l3x6H1brw xpDtdRXJGp6cr/HJkPlh5+2fxMIGT+viPeb0QVQmZrfG1RLzkdzxkD5lwX/xem1gAhVg //YNxU0dVkjIuCiU/f46+/vvTNr0DKoaw8QXEY7WE44ZPibVJwwg3WWk3FgRAtKwyNLT ejs7c813NwHUuiVKUMJm4TP4vwYPUn7V+7J33WqMvc0VQGIUPpmAc4uoCPKFm7yN38Ot YwdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765194452; x=1765799252; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4okenSK+FWacRX0/UFto8Btvp96AOr1jENqIpaAT3Xo=; b=MxPaUIwejJU/pRKCI3Ag2nki6A92ooPtzcnfYlK/E10A4Z04WelXo4L+HD7VwveOxk Fdp8X8MJAHxP8PceBEQQTzt33Ikl5opYbODhQDylTM32BXEcCplLWIPFMqwP2q665RQd 2uXfuvOzE4ELY/0NcQv5Hv8Jo+aEldZw8cwwt7piVs+Ao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-Received: by 2002:a05:693c:2506:b0:2ab:ca55:89b7 with SMTP id 5a478bee46e88-2abca55989dmr2781449eec.42.1765194451659; Mon, 08 Dec 2025 03:47:31 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c0:da21:d7a:68ef:9b64:722f? ([2804:1b3:a7c0:da21:d7a:68ef:9b64:722f]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2aba87d7b9dsm46282169eec.4.2025.12.08.03.47.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Dec 2025 03:47:31 -0800 (PST) Message-ID: Date: Mon, 8 Dec 2025 08:47:27 -0300 Precedence: bulk X-Mailing-List: util-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] x32: Implement prctl in assembly To: Florian Weimer , "H.J. Lu" Cc: Alejandro Colomar , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , util-linux@vger.kernel.org, Xi Ruoyao , GNU C Library References: <20240601093150.16912-1-alx@kernel.org> <460edfcb-4dc0-418c-9f4d-eb74261701c8@t-8ch.de> <5272b875-bec8-4b28-84e8-05606db83120@linaro.org> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 08/12/25 06:09, Florian Weimer wrote: > * H. J. Lu: > >> On Mon, Dec 8, 2025 at 4:11 PM Florian Weimer wrote: >>> >>> * H. J. Lu: >>>> Here is the v2 patch to implement prctl in assembly for x32. >>>> >>>> Since the variadic prctl function takes at most 5 integer arguments which >>>> are passed in the same integer registers on x32 as the function with 5 >>>> integer arguments, we can use assembly for prctl. Since upper 32-bits in >>>> the last 4 arguments of prctl must be cleared to match the x32 prctl >>>> syscall interface where the last 4 arguments are unsigned 64 bit longs, >>>> implement prctl in assembly to clear upper 32-bits in the last 4 arguments >>>> and add a test to verify it. >>> >>> What's the advantage of the assembler implementation over the C >>> implementation? I'm missing the context for this change. >>> >> >> It is inspired by >> >> commit 6a04404521ac4119ae36827eeb288ea84eee7cf6 >> Author: Florian Weimer >> Date: Sat Feb 17 09:17:04 2024 +0100 >> >> Linux: Switch back to assembly syscall wrapper for prctl (bug 29770) > > The justification for that does not apply to x32, though, because prctl > doesn't take floating point arguments. I don't have a strong opinion, > the C and assembler versions are of similar complexity. The main justification is UB to va_args *all* the arguments without taking in the consideration which option is passed. If x32 requires additional argument handling to clear the upper 32-bits, there is no advantage of using the assembly wrapper.