get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2217150/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2217150,
    "url": "http://patchwork.ozlabs.org/api/patches/2217150/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260327174434.2852296-2-adhemerval.zanella@linaro.org/",
    "project": {
        "id": 41,
        "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api",
        "name": "GNU C Library",
        "link_name": "glibc",
        "list_id": "libc-alpha.sourceware.org",
        "list_email": "libc-alpha@sourceware.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260327174434.2852296-2-adhemerval.zanella@linaro.org>",
    "list_archive_url": null,
    "date": "2026-03-27T17:44:24",
    "name": "[2/2] aarch64: Accept string values for glibc.cpu.aarch64_gcs tunable",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3a518b893a373cad12adc056e9b927149da7fda7",
    "submitter": {
        "id": 66065,
        "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api",
        "name": "Adhemerval Zanella Netto",
        "email": "adhemerval.zanella@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260327174434.2852296-2-adhemerval.zanella@linaro.org/mbox/",
    "series": [
        {
            "id": 497811,
            "url": "http://patchwork.ozlabs.org/api/series/497811/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=497811",
            "date": "2026-03-27T17:44:23",
            "name": "[1/2] aarch64: Convert GCS policy states to an enum",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497811/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217150/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217150/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "libc-alpha@sourceware.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "libc-alpha@sourceware.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=ePaQzGS/;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=ePaQzGS/",
            "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=linaro.org",
            "sourceware.org; spf=pass smtp.mailfrom=linaro.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::e2b"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fj7Nb44nQz1y1P\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 04:46:07 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 3B58C4BA23F5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 17:46:05 +0000 (GMT)",
            "from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com\n [IPv6:2607:f8b0:4864:20::e2b])\n by sourceware.org (Postfix) with ESMTPS id B4B954BA900F\n for <libc-alpha@sourceware.org>; Fri, 27 Mar 2026 17:44:42 +0000 (GMT)",
            "by mail-vs1-xe2b.google.com with SMTP id\n ada2fe7eead31-602903ad849so816452137.3\n for <libc-alpha@sourceware.org>; Fri, 27 Mar 2026 10:44:42 -0700 (PDT)",
            "from mandiga.. ([2804:1b3:a7c1:90ea:62b5:ca73:a5e8:4825])\n by smtp.gmail.com with ESMTPSA id\n a1e0cc1a2514c-951be56f28esm7578251241.10.2026.03.27.10.44.39\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 27 Mar 2026 10:44:41 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 3B58C4BA23F5",
            "OpenDKIM Filter v2.11.0 sourceware.org B4B954BA900F"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org B4B954BA900F",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org B4B954BA900F",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774633482; cv=none;\n b=Dyy0ZaRw7lbMhqdecTwpOxcq1v3iNwYrHlqAVwy9oDceS9kuR7/ia6weo6xao3ZSNWDcfoT6py2h8C7YlPspsJLRRGb2zL/XDcIh6xTNZU9bvXsPcq94n1vO8PdVYGgWV1J//uuMXhPAKB5JKu1DgovV/wXhgfp7Whb7GVtiOe8=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774633482; c=relaxed/simple;\n bh=J13VxDZcjfHSsw5ipcGepfiSAVxr0XU21xU5VLc+IRA=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=OProKu23rtfGmUK5AKQ6GKLX5QCDt6qLWxHEme5S1UAf/oF23HvXHvL2JAw5MIvZZT1gYuSZzRepXjt8ngsaCA+3h9SNkGw5yKN/amke6Bj/5ItbdJ0qVOwCnoS691/7U1GaRFBkcCbmbk4GKDdi40z5z4Vz51L4LApnbUtx23o=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1774633482; x=1775238282; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=KozdqQlKLIAvVgfuA5qoWrZZ+hcnV2CSGwwqzoLoB6c=;\n b=ePaQzGS/tPiIbQZI/vtZ8vhEFomYSZn0X0cCaDdqGvVTzTUQXOtITBteatCYcR933a\n 2dFMgzx4EWIjNOBpI2gyNTBX5nLmrO5FHwH+0F4DsNcMCj8nrSV8NpKKYuTt6iRTaQJp\n dj4Y8D/Un+SuJotNAWta7EdyY3CJx3PiZqUuEYgpqMkyOBq5C4GTrGdatf9jcOO4+GUR\n QCpM3SbuMDeNhoOBBKiIFmH5VQF0UY5MBJKuHfLG7jvPAxJLGdpxsLxQJid4XS72/W9o\n rMV8kVLR0+AKM/ZAVleaYCpE8xi2+x6vIy4U2jpo9QRWujaIRpVbu4Q0InV79FuwAkg0\n hP+A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774633482; x=1775238282;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=KozdqQlKLIAvVgfuA5qoWrZZ+hcnV2CSGwwqzoLoB6c=;\n b=gxfG2bYOyNJoi9LiV3fBlqV1nl6nwlp1IyG70ALR/x/mhsnXWuAIsAb0SWg/RPWkcY\n nq2yUaOD9lZY4zA7cHvC/iEEE85u65SCFUfLJMZznkGFUMUB7Y8nDlGa2KL1tUCMwiy8\n w9w/2ITBC6v+vtXq+lr6/EaTtmCRnEQUkHAXQzPH4GKRdbzoQKfQQuNhtkYa246/SZjT\n 7xBdrdC5dB0C1ZkdsV5JKIhYpGiriIKnzQXJiLkVH0OMDiI4umv2rRDmaOAyYRkVx4lW\n DJiAwhFHa87qJ/NfIsVDyFCfqpALezqOE06UKIj0DJwveP9qbkPb7qGxY8IRP73qOcFK\n WeyQ==",
        "X-Gm-Message-State": "AOJu0Ywrvas1VSb3PcHRNxFdEfwN2C3rGfdtTYqjR5GFpXcM9KSuGYtp\n sy9tQ4cLs4HF1foD+EL1V8jIZ/Qc3tfdJRfdfTD9tUZibK0HwE3mHeAebXeYSVA6zjGdBiZtuIn\n ldKEb",
        "X-Gm-Gg": "ATEYQzy4YGpDShK2qdvvJWWdsEtPohR4Y33Bhnj48opV1gyst/dFvkXhcMp1X4BpJ8k\n wGJ2Gc1uKAxIPwsF+/4kqj390O1HRfV16sZNd9fP0SD69yzW7Ex0i1btKjIOKQKT86NPsTS1EjS\n TLP8HNmpWy2Bn82/vOF9vdsdDa/7b9sWPTVC/Qr5p7E/i6Wr+bynsSgk0g3fG1GaDg/QFjSJhoA\n TFYtw0FpLuQ74uhI9VlrrEJlvpu8a0gdpNjrqFFzOhuRVKMnIxgdFDVUwDnFlPBlAmUTwz8EOdW\n tMlWWY2ssxqzllP+SbUHqFcqCX/uyDAJrSIX0HzA//M6IZ3WINcYOVkYp34mFTgzchDo/8SLwA3\n oMEkIbirdwY4XrPycgkROhTiy45NdxWBXkPQvWwKuZOa1Rc3zlZj5MPI9SZj98/zenl23nBGcZS\n 5J73X3cJF/+bCD31TX3rjjZkQl4IVNbKdxm7s67yXD8mdHFA==",
        "X-Received": "by 2002:a05:6102:2c17:b0:5ff:f366:dbe1 with SMTP id\n ada2fe7eead31-604f90f12f8mr1429114137.15.1774633481655;\n Fri, 27 Mar 2026 10:44:41 -0700 (PDT)",
        "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>",
        "To": "libc-alpha@sourceware.org",
        "Cc": "Yury Khrustalev <yury.khrustalev@arm.com>,\n Wilco Dijkstra <wilco.dijkstra@arm.com>",
        "Subject": "[PATCH 2/2] aarch64: Accept string values for glibc.cpu.aarch64_gcs\n tunable",
        "Date": "Fri, 27 Mar 2026 14:44:24 -0300",
        "Message-ID": "<20260327174434.2852296-2-adhemerval.zanella@linaro.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260327174434.2852296-1-adhemerval.zanella@linaro.org>",
        "References": "<20260327174434.2852296-1-adhemerval.zanella@linaro.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>,\n <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>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>",
        "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org"
    },
    "content": "This patch updates the glibc.cpu.aarch64_gcs tunable to accept\nhuman-readable strings in addition to its standard numerical values.\n\nThe tunable now accepts the strings 'disabled', 'enforced', 'optional',\nand 'override', mapping them to their corresponding 0, 1, 2, and 3 internal\nenum states.\n\nTo support custom parsing in architecture-specific code, the\n'tunable_parse_num' function is moved to the generic dl-tunables-parse.h\nas an inline function.\n\nThe '__tunable_print_error' function is exposed globally so that invalid\nstring inputs caught in the newly added 'aarch64_gcs' callback can trigger\nstandard tunable warnings.\n\nChecked on aarch64-linux-gnu.\n---\n elf/dl-tunables.c                             | 29 +++++++++----------\n elf/dl-tunables.h                             |  3 ++\n manual/tunables.texi                          |  8 ++---\n sysdeps/aarch64/dl-tunables.list              |  5 +---\n sysdeps/generic/dl-tunables-parse.h           | 13 +++++++++\n .../unix/sysv/linux/aarch64/cpu-features.c    | 28 +++++++++++++++++-\n 6 files changed, 61 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c\nindex bdb1de4ceb..7fd6894ec9 100644\n--- a/elf/dl-tunables.c\n+++ b/elf/dl-tunables.c\n@@ -36,6 +36,7 @@\n \n #define TUNABLES_INTERNAL 1\n #include \"dl-tunables.h\"\n+#include <dl-tunables-parse.h>\n \n static char **\n get_next_env (char **envp, char **name, char **val, char ***prev_envp)\n@@ -119,17 +120,6 @@ do_tunable_update_val (tunable_t *cur, const tunable_val_t *valp,\n   cur->initialized = true;\n }\n \n-static bool\n-tunable_parse_num (const char *strval, size_t len, tunable_num_t *val)\n-{\n-  char *endptr = NULL;\n-  uint64_t numval = _dl_strtoul (strval, &endptr);\n-  if (endptr != strval + len)\n-    return false;\n-  *val = (tunable_num_t) numval;\n-  return true;\n-}\n-\n /* Validate range of the input value and initialize the tunable CUR if it looks\n    good.  */\n static bool\n@@ -239,14 +229,21 @@ parse_tunables_string (const char *valstring, struct tunable_toset_t *tunables)\n   return ntunables;\n }\n \n-static void\n-parse_tunable_print_error (const struct tunable_toset_t *toset)\n+\n+void\n+__tunable_print_error (const char *value, size_t len, const char *name)\n {\n   _dl_error_printf (\"WARNING: ld.so: invalid GLIBC_TUNABLES value `%.*s' \"\n \t\t    \"for option `%s': ignored.\\n\",\n-\t\t    (int) toset->len,\n-\t\t    toset->value,\n-\t\t    toset->t->name);\n+\t\t    (int) len,\n+\t\t    value,\n+\t\t    name);\n+}\n+\n+static inline void\n+parse_tunable_print_error (const struct tunable_toset_t *toset)\n+{\n+  __tunable_print_error (toset->value, toset->len, toset->t->name);\n }\n \n static void\ndiff --git a/elf/dl-tunables.h b/elf/dl-tunables.h\nindex 45aeed47bc..9a1d12922e 100644\n--- a/elf/dl-tunables.h\n+++ b/elf/dl-tunables.h\n@@ -61,6 +61,9 @@ rtld_hidden_proto (__tunable_get_val)\n rtld_hidden_proto (__tunable_set_val)\n rtld_hidden_proto (__tunable_get_default)\n \n+extern void __tunable_print_error (const char *, size_t, const char *)\n+  attribute_hidden;\n+\n /* Define TUNABLE_GET and TUNABLE_SET in short form if TOP_NAMESPACE and\n    TUNABLE_NAMESPACE are defined.  This is useful shorthand to get and set\n    tunables within a module.  */\ndiff --git a/manual/tunables.texi b/manual/tunables.texi\nindex 72769428e8..b8befde341 100644\n--- a/manual/tunables.texi\n+++ b/manual/tunables.texi\n@@ -605,12 +605,12 @@ This tunable controls Guarded Control Stack (GCS) for the process.\n Accepted values are:\n \n @itemize @bullet\n-@item @code{0} = disabled: do not enable GCS.\n-@item @code{1} = enforced: check markings and abort if any binary is not\n+@item @code{0} or @code{disabled}: do not enable GCS.\n+@item @code{1} or @code{enforced}: check markings and abort if any binary is not\n marked, otherwise enable GCS and lock all GCS features.\n-@item @code{2} = optional: check markings but keep GCS off if any binary\n+@item @code{2} or @code{optional}: check markings but keep GCS off if any binary\n is unmarked, otherwise enable GCS but do not lock any GCS features.\n-@item @code{3} = override: enable GCS and lock all GCS features, markings\n+@item @code{3} or @code{override}: enable GCS and lock all GCS features, markings\n are ignored.\n @end itemize\n \ndiff --git a/sysdeps/aarch64/dl-tunables.list b/sysdeps/aarch64/dl-tunables.list\nindex a2ccba0b29..302cbac437 100644\n--- a/sysdeps/aarch64/dl-tunables.list\n+++ b/sysdeps/aarch64/dl-tunables.list\n@@ -28,10 +28,7 @@ glibc {\n       default: 0\n     }\n     aarch64_gcs {\n-      type: UINT_64\n-      minval: 0\n-      maxval: 3\n-      default: 0\n+      type: STRING\n     }\n   }\n }\ndiff --git a/sysdeps/generic/dl-tunables-parse.h b/sysdeps/generic/dl-tunables-parse.h\nindex 8ac49bff0b..f021036bbd 100644\n--- a/sysdeps/generic/dl-tunables-parse.h\n+++ b/sysdeps/generic/dl-tunables-parse.h\n@@ -131,4 +131,17 @@ tunable_str_comma_strcmp (const struct tunable_str_comma_t *t, const char *str,\n #define tunable_str_comma_strcmp_cte(__t, __str) \\\n   tunable_str_comma_strcmp (__t, __str, sizeof (__str) - 1)\n \n+static inline bool\n+tunable_parse_num (const char *strval, size_t len, tunable_num_t *val)\n+{\n+  char *endptr = NULL;\n+  uint64_t numval = _dl_strtoul (strval, &endptr);\n+  if (endptr != strval + len)\n+    return false;\n+  *val = (tunable_num_t) numval;\n+  return true;\n+}\n+#define tunable_parse_num_tun(__tunable, __ret) \\\n+  tunable_parse_num (__tunable->strval.str, __tunable->strval.len, __ret)\n+\n #endif\ndiff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c\nindex 1e4f8a86b1..fe634cbded 100644\n--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c\n+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c\n@@ -65,6 +65,31 @@ get_midr_from_mcpu (const struct tunable_str_t *mcpu)\n   return UINT64_MAX;\n }\n \n+static void\n+TUNABLE_CALLBACK (aarch64_gcs) (tunable_val_t *valp)\n+{\n+  tunable_num_t val;\n+  if (tunable_parse_num_tun (valp, &val))\n+    {\n+      if (tunable_val_lt (val, AARCH64_GCS_POLICY_DISABLED, true))\n+\tval = AARCH64_GCS_POLICY_DISABLED;\n+      if (tunable_val_gt (val, AARCH64_GCS_POLICY_OVERRIDE, true))\n+\tval = AARCH64_GCS_POLICY_OVERRIDE;\n+      GL(dl_aarch64_gcs) = val;\n+    }\n+  else if (tunable_strcmp_cte (valp, \"disabled\"))\n+    GL(dl_aarch64_gcs) = AARCH64_GCS_POLICY_DISABLED;\n+  else if (tunable_strcmp_cte (valp, \"enforced\"))\n+    GL(dl_aarch64_gcs) = AARCH64_GCS_POLICY_ENFORCED;\n+  else if (tunable_strcmp_cte (valp, \"optional\"))\n+    GL(dl_aarch64_gcs) = AARCH64_GCS_POLICY_OPTIONAL;\n+  else if (tunable_strcmp_cte (valp, \"override\"))\n+    GL(dl_aarch64_gcs) = AARCH64_GCS_POLICY_OVERRIDE;\n+  else\n+    __tunable_print_error (valp->strval.str, valp->strval.len,\n+\t\t\t   \"glibc.cpu.aarch64_gcs\");\n+}\n+\n static inline void\n init_cpu_features (struct cpu_features *cpu_features)\n {\n@@ -136,5 +161,6 @@ init_cpu_features (struct cpu_features *cpu_features)\n \n   if (GLRO (dl_hwcap) & HWCAP_GCS)\n     /* GCS status may be updated later by binary compatibility checks.  */\n-    GL (dl_aarch64_gcs) = TUNABLE_GET (glibc, cpu, aarch64_gcs, uint64_t, 0);\n+    TUNABLE_GET (glibc, cpu, aarch64_gcs, tunable_val_t *,\n+\t\t TUNABLE_CALLBACK (aarch64_gcs));\n }\n",
    "prefixes": [
        "2/2"
    ]
}