Message ID | 20231206132402.1356644-1-adhemerval.zanella@linaro.org |
---|---|
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E7023858D39 for <patchwork@sourceware.org>; Wed, 6 Dec 2023 13:24:23 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 2C8DE3858C54 for <libc-alpha@sourceware.org>; Wed, 6 Dec 2023 13:24:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C8DE3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2C8DE3858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701869050; cv=none; b=eAKoyg7Lt686IJiRLXwtx4gtD5I3JdcO+NBPFAPxKj13iYpOawYQUlZMKZxvotAkgnT0lgrhzeJdllBa0Ewy5OAB40GKVGYbzghjJgr4O/VPPRrI270ZqchGJwF7tjsShZmUGfu52DMXIvZkk2K4qonw1GrOYcNT4Kw5uaaakLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701869050; c=relaxed/simple; bh=aDVI8vHO0R86D7iGSSULp/V2VPesBPio17Dd4Rx33CE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=s0kDGcjNc8I8NLZYrIqNMiJnEK0cRMoRJLA4X/d4rWntgo7nwIhlHltd2qMLTUc4PdbBSl4zI/DXLsT+bluo7lV9up2C9BqQMGjUSjR0+Pw0g25v4eYOQr1hBJXxCaasJKEFDxXQ9u01iDogc46ML/jVUyMNt6DUT6gwJ4ePfiY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6ce72faf1e8so1303461b3a.0 for <libc-alpha@sourceware.org>; Wed, 06 Dec 2023 05:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701869046; x=1702473846; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Zg1VxcADULak8GnV90JoW55uWQbZN0gZ2F2U0HD8soU=; b=Uu0g/cmY/+T1KlXmwg7bE++xhSFJPEgGszCtkPlO/jLFcCPVGlEK+gJ4EhAigDd4ah 8MAe3o5Q6uekNM3iKQ2EDZJ72WGiqp+X7PAQjsjugDL1w1E8T+gEkFpNgZGqbP84+fin dPYEM2wIYqPacIh0aZMSyx19Jp+VwtrYLfChV5AZFlbr7HbSNydsghIxx2ukNY/URsdY fqFoezHKU/KAaXBXXl8pVDq1f3i/6wjxPUmT6yPxXX3KWLwrwQoP23FcqW1X7WjcrOwG UaVfRTSTKRkv32ut1Q24PTwgfSd6dgtX5jIiWWm4tHp2iSTiC+69J1WtNgZjsDTl1v/1 GJQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701869046; x=1702473846; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Zg1VxcADULak8GnV90JoW55uWQbZN0gZ2F2U0HD8soU=; b=Exgoyp3C23MJiJN+Y0KhuLPlgRT6hUEHyiPVuluIaUnpz3zj/3A8oxVP5mVqyo1dGc 95O1eokt6SpLXzM5V2J++5KNR2UlrHOjKxxAWaLkhZMnF2BXJ4TxoBUS9B+H6FNjMA03 wXYjbYJvGCqUYnQYuXFNM278Wa8K8/fsZdDkwibRAsczvwQloqxX7OCPmH3kpP818NRB c7mttWVtfHVG+Up9TADHBqOUoFUZQjVFd/7h1qz6i97hWChq5qXZrISdug5o6yt/QJES gatYBGveE9lVKblq3zOTqjwZGR4mOu5Dt/I8brrZ8TpRYeXJDVVNTRw/bZT+iwLHGeEw aCXw== X-Gm-Message-State: AOJu0YyswZlhVvpmIxH4Kzx+4sp5luCvcy/FyCe26JhR3bPZeOgQbOTM YniZR/91QBa/nfojFmvJ3CL6UBBLZvrEDj4KysE= X-Google-Smtp-Source: AGHT+IHdJb1o+SEoz0FLKX2EYplonSG3Av3rGq0tPq2Psamk9IxrdFdtSWkjX0cpdSIuZTaspewXOQ== X-Received: by 2002:a05:6a20:c19e:b0:18f:97c:8254 with SMTP id bg30-20020a056a20c19e00b0018f097c8254mr844198pzb.94.1701869046505; Wed, 06 Dec 2023 05:24:06 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:56e1:da8e:9a8e:e071:49b6]) by smtp.gmail.com with ESMTPSA id b19-20020a17090ae39300b0028672a85808sm7449168pjz.35.2023.12.06.05.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 05:24:05 -0800 (PST) From: Adhemerval Zanella <adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org, Siddhesh Poyarekar <siddhesh@sourceware.org> Subject: [PATCH v6 0/2] Improve loader environment variable handling Date: Wed, 6 Dec 2023 10:24:00 -0300 Message-Id: <20231206132402.1356644-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Improve loader environment variable handling
|
|
Message
Adhemerval Zanella
Dec. 6, 2023, 1:24 p.m. UTC
Itremoves the tunable_strdup and make the GLIBC_TUNABLE parsing in place (no more possible allocation failure). The parsing now tracks the tunable string start and its size. The dl-tunable-parse.h adds helper functions to help to parse, like an strcmp that also checks for size and an iterator for suboptions that are comma-separated (used on hwcap parsing by x86, powerpc, and s390x). -- Changes from v5: * Only parses the alias environment variable lenght if required. * Fixed _dl_strtoul for hexa and octal inputs. Changes from v4: * Improve tunables value handling, now warnings for invalid and out of range numbers. Changes from v3: * Fixed tunable_initialize for strong aliases (it used the key length, instead of the value length). * Added a assert on tunable_str_comma_init to ensure its value is non null. * Added LD_WARN and LD_VERBOSE to filtered environment variables. Changes from v2: * Extend tst-tunables with tunables aliases tests. * Use warning instead of an error to indicate invalid tunables. * Fixed tunable_initialize for string aliases. Changes from v1: * Ignore most of the environment variables on security-sensitive mode. * Extend tests. Adhemerval Zanella (2): elf: Do not duplicate the GLIBC_TUNABLES string elf: Do not set invalid tunables values elf/dl-misc.c | 10 +- elf/dl-tunables.c | 113 ++++++------ elf/dl-tunables.h | 6 +- elf/tst-tunables.c | 96 +++++++++- sysdeps/generic/dl-tunables-parse.h | 134 ++++++++++++++ sysdeps/s390/cpu-features.c | 165 +++++++----------- .../unix/sysv/linux/aarch64/cpu-features.c | 33 ++-- .../unix/sysv/linux/powerpc/cpu-features.c | 45 ++--- .../sysv/linux/powerpc/tst-hwcap-tunables.c | 6 +- sysdeps/x86/Makefile | 4 +- sysdeps/x86/cpu-tunables.c | 118 +++++-------- sysdeps/x86/tst-hwcap-tunables.c | 148 ++++++++++++++++ 12 files changed, 592 insertions(+), 286 deletions(-) create mode 100644 sysdeps/generic/dl-tunables-parse.h create mode 100644 sysdeps/x86/tst-hwcap-tunables.c