From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f202.google.com (mail-oi1-f202.google.com [209.85.167.202]) (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 E6F961E5B70 for ; Fri, 5 Dec 2025 00:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764896327; cv=none; b=gpsCL64fsTrz/Wt5u5ErqDMYXF8Hwt9l0tzHdVnO5grTDgHOjofRAJPm2YwdEUklGsV5Oq9yNQcdqUoVpj7Kb3N39RQpGUXL9ebIv/XPVkI/8QXUjpbAY52UqRpQWgeKkcP+JLEHFjDds5YV2nmZV6MjqIQK778+g/+nGs0rIPQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764896327; c=relaxed/simple; bh=CIVMhsmo/TLmEOyl5Xrhk9a4+n50fRfvlX0rCbVLbJQ=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=jJQqNeq7sh/MQzWnQhT8gzaEJIPuQR7kOb3HNX5TJTCAi/EIXRLsj9tJmSYedIvLldJ33sYsCd4+eiD9CUoAhb4cfqIyyFfwP0jUEFvYVCexBYD9OKV8jmZkek3mznUD0TN3RVcI5ueQUW0uhwsbDMETHIZJShr3/FfHlXCYO/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--avagin.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cDzyQ5J0; arc=none smtp.client-ip=209.85.167.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--avagin.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cDzyQ5J0" Received: by mail-oi1-f202.google.com with SMTP id 5614622812f47-450d471e085so2078965b6e.0 for ; Thu, 04 Dec 2025 16:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764896325; x=1765501125; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=OkIFDglYe+NNTa2m54quJMQQhad7qn1qBiLg81dFGHA=; b=cDzyQ5J0U4qOPMkcoGx0c1R+qunsQRIyLAeqgBgcR2kk9LLmtoaribCYz9cp3x3XDy 7EMlB0jLhu9zUb6pwexYrjnBqA+8yccAcRKB4GPUjtiPNGSrdDqwMlwUd7+FZiTqqEn0 67h/1w2b8b2Nwe5F6Z3SdG44E4whXdJuiVPnTsarKG2TH/3g2LDiC59sWnbjmzPcnQia 2VKQVi3INO5sWYBfcTRVhTfcRHGCBdXXsBy+e0eUNMsxHm1nfaLrZcopy9tpW4Luk5ah hKJk6P6KAAWOY4KwEB0M25/xbDJMGYDVSNFrxTi0njkPEehlN3ClwrY1rG9wFWqi8cNk EEcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764896325; x=1765501125; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OkIFDglYe+NNTa2m54quJMQQhad7qn1qBiLg81dFGHA=; b=KwqoLBGT/5+b1NxDZGcivum96kd+2glJixhXydo0ELx6c120G9JXahM+ijPBjaEU/O nAcIC2WWrNE1YCNxgeg/TUsltVIcZo0RKYMwJ56jgc4QVM2Z56hoN4vXH9hn0xIIEOCL fD/GrkJY1FWEOUyElyxJED5TTOtdzVHs2zI4IVExpLWQr822/K+6tnpHsk/z8+2bBorx hFXpc6NUWJQYlwnw0gie1QyI5HpeFhVYbf8zL8KuhK1jlcZN8OjXzCdQfDt4t0yItOID zaXnp+g5KN6+rK35fM1HnBskxpF5p4Duohwrto8bm6yBLjuzP29S9bAd9ALGFoOY2rN9 6SjA== X-Gm-Message-State: AOJu0YycpvWtgv5kYKr6Dhkfwa8CmFVRUulCKOL6N+bj5sL1D3hX0L5n eEoLdiaIKTSZQE/nUXIB6SIWDENtH72TGApS4iDS+6st44iiUg+y5IbjjXPDU9o0quAaSMZjSV+ fK+zoYA== X-Google-Smtp-Source: AGHT+IHj0LPEa/ejQQf0MUYWeJwJfYADQwqU4BCYqxCRyoUpapAb59gw8xQzZvkTJOVDLbICm1TVHGWi4NY= X-Received: from ioby11.prod.google.com ([2002:a6b:d80b:0:b0:949:806:8e17]) (user=avagin job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:2383:b0:44d:aa8b:58f6 with SMTP id 5614622812f47-45379d21b91mr2858055b6e.1.1764896324986; Thu, 04 Dec 2025 16:58:44 -0800 (PST) Date: Fri, 5 Dec 2025 00:58:28 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.223.gf5cc29aaa4-goog Message-ID: <20251205005841.3942668-1-avagin@google.com> Subject: [PATCH 0/3] cgroup/misc: Add hwcap masks to the misc controller From: Andrei Vagin To: Kees Cook Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, criu@lists.linux.dev, Tejun Heo , Johannes Weiner , "=?UTF-8?q?Michal=20Koutn=C3=BD?=" , Vipin Sharma , Jonathan Corbet Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This patch series introduces a mechanism to mask hardware capabilities (AT_HWCAP) reported to user-space processes via the misc cgroup controller. To support C/R operations (snapshots, live migration) in heterogeneous clusters, we must ensure that processes utilize CPU features available on all potential target nodes. To solve this, we need to advertise a common feature set across the cluster. This patchset allows users to configure a mask for AT_HWCAP, AT_HWCAP2. This ensures that applications within a container only detect and use features guaranteed to be available on all potential target hosts. The first patch adds the mask interface to the misc cgroup controller, allowing users to set masks for AT_HWCAP, AT_HWCAP2... The second patch adds a selftest to verify the functionality of the new interface, ensuring masks are applied and inherited correctly. The third patch updates the documentation. Cc: Kees Cook Cc: Tejun Heo Cc: Johannes Weiner Cc: "Michal Koutn=C3=BD" Cc: Vipin Sharma Cc: Jonathan Corbet Andrei Vagin (3): cgroup, binfmt_elf: Add hwcap masks to the misc controller selftests/cgroup: Add a test for the misc.mask cgroup interface Documentation: cgroup-v2: Document misc.mask interface Documentation/admin-guide/cgroup-v2.rst | 25 ++++ Documentation/arch/arm64/elf_hwcaps.rst | 21 ++++ fs/binfmt_elf.c | 24 +++- include/linux/misc_cgroup.h | 25 ++++ kernel/cgroup/misc.c | 126 +++++++++++++++++++++ tools/testing/selftests/cgroup/.gitignore | 1 + tools/testing/selftests/cgroup/Makefile | 2 + tools/testing/selftests/cgroup/config | 1 + tools/testing/selftests/cgroup/test_misc.c | 114 +++++++++++++++++++ 9 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 tools/testing/selftests/cgroup/test_misc.c