From nobody Sun Nov 24 18:05:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1722305340; cv=none; d=zohomail.com; s=zohoarc; b=mCvydTtMvxJE+U0UVHcjGNev+2VhlEyICF99jkrhH2W71yz0QCld4iBLWdKqtrO3SE5OufuNGU1ntAQpRxojuZdN/lj/0zKjgpCo+G2i4kpsDQ4COnjp6go99Y82nIJcYxweoIJZ3Ca2SGe4m1LEbD4IC/91HP6Pr7YbrBpAT1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722305340; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pvF0s1jQIBySSeBKtBCNdIkStj9P9gT/o0jVZTBUvsc=; b=IpRI8pv7CNoRxHcSHETDz6ndrnGdl85Hk1QrfRg0vBfqX6UoPas0OXI2Y2p8WMBiGkP3nv8EIFdtu39ggsNhmeuhIjI07lCTn4b2CC0mptmqsWlGb1D/mrJ0ni0C6l4UPRLS1slW29RobJglorviu99feD0Bcn9PxUvhk7diMaI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722305340450113.21667955033115; Mon, 29 Jul 2024 19:09:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYcIA-00029a-9t; Mon, 29 Jul 2024 22:08:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sYcI8-00028Q-Vl for qemu-devel@nongnu.org; Mon, 29 Jul 2024 22:08:45 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYcI4-0003EO-MZ for qemu-devel@nongnu.org; Mon, 29 Jul 2024 22:08:44 -0400 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-39865a15900so14992145ab.1 for ; Mon, 29 Jul 2024 19:08:40 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7a9f7c6ff4bsm6750206a12.4.2024.07.29.18.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 18:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722305319; x=1722910119; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pvF0s1jQIBySSeBKtBCNdIkStj9P9gT/o0jVZTBUvsc=; b=SRfgQLDSCgy+V4bj1tnzi59BhqeBMwpPT7/WuQSo3ISmvtT4RjStcBnlAVSQtur7Za rGJet5HsgZHjDlmmXouXudrwU1l0EiHgElOQUVcnlcoUfUMJFQTDn6h9/0HwqjBBxMxP 07bD25YrZ91gfojAxtjFvbxuQiWKOruraf0IXp2UfO30xDEvzxrFVJHzsjY1nUjRytu2 hxF8tUQiJ+J1/1/UCZp/SKnXku/bcrlOJT1VeUVSgbmiyLDS/c11jv2qKkIFNWSitk3n OlQZ2EZKSumcOGKY4MG2dPYaAWp3cX8XVqhKUaBqxNJe4QxWiAkY4/v5gczM/4WtreFH cusQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722305319; x=1722910119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pvF0s1jQIBySSeBKtBCNdIkStj9P9gT/o0jVZTBUvsc=; b=j/v33bAtyrEPLg3K98waG9+kIv+qz0uwR4OYvdq6qXB/kCzGgFsPSCZdqE4zFIH5wk KowmrgGWHOx3jrvxzL1stoXJ5ITNtjoo4XYWQD5pQ7tMGYMpmFTMzQCmYRJTLe/X1Cuy KMFGrNFk/NcEJs7F6WQCRlK4uUphv5yAmPM+5aLIpy3Sjku0waeOM857E3+7JbyPPIYU SIeimbHtjWmyIdB8W1QZx/L6HCobZ4AcTAgs/f0YgOVMWRW3yuwE/Il/1/8UXrrM/1Nh C9VTbP49z2ruwSc6CO6tWLsIZKT2Is+R8kPIj3fPNle4DRKby8VW9Y06+bRQUpghUhtW JGCQ== X-Gm-Message-State: AOJu0Yw3ngQ4v+VgXDJvX7suVNnBfBpfw8HZELUsslB4S59Hf/YllHqH MxhTK9KPVwRealKNuqClINJ6G2xmFaiEU7HJe0Rs3OQu035b3gFDtu7zgqjbSnkgVVmcxaUvHtZ O4aM= X-Google-Smtp-Source: AGHT+IFTIf7LOeBm+FjgWoD0szE5P73hRxwPZGfNUF9Ox3Ri/JAmTT5m+cx07MMpvDb2M0XFQ+cyAA== X-Received: by 2002:a05:6a00:2443:b0:70d:2583:7223 with SMTP id d2e1a72fcca58-70ecea2ef3emr11413551b3a.17.1722301934907; Mon, 29 Jul 2024 18:12:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Vivian Wang Subject: [PULL 2/5] util/getauxval: Ensure setting errno if not found Date: Tue, 30 Jul 2024 11:11:59 +1000 Message-ID: <20240730011202.480829-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730011202.480829-1-richard.henderson@linaro.org> References: <20240730011202.480829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1722305341929116600 Content-Type: text/plain; charset="utf-8" From: Vivian Wang Sometimes zero is a valid value for getauxval (e.g. AT_EXECFD). Make sure that we can distinguish between a valid zero value and a not found entry by setting errno. Assumes that getauxval from sys/auxv.h sets errno correctly. Signed-off-by: Vivian Wang Message-ID: <20240723100545.405476-2-uwu@dram.page> Signed-off-by: Richard Henderson --- util/getauxval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/getauxval.c b/util/getauxval.c index b124107d61..ad4f6686a8 100644 --- a/util/getauxval.c +++ b/util/getauxval.c @@ -95,6 +95,7 @@ unsigned long qemu_getauxval(unsigned long type) } } =20 + errno =3D ENOENT; return 0; } =20 @@ -104,7 +105,10 @@ unsigned long qemu_getauxval(unsigned long type) unsigned long qemu_getauxval(unsigned long type) { unsigned long aux =3D 0; - elf_aux_info(type, &aux, sizeof(aux)); + int ret =3D elf_aux_info(type, &aux, sizeof(aux)); + if (ret !=3D 0) { + errno =3D ret; + } return aux; } =20 @@ -112,6 +116,7 @@ unsigned long qemu_getauxval(unsigned long type) =20 unsigned long qemu_getauxval(unsigned long type) { + errno =3D ENOSYS; return 0; } =20 --=20 2.43.0