Received: from mail-oo1-f74.google.com (mail-oo1-f74.google.com [209.85.161.74]) (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 BD9CD28689A for ; Thu, 8 Jan 2026 05:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767848874; cv=none; b=ILeWFZq9jh9g2hCmrq8plhbsAkzLHiXLAd9MrPeJtIoWwuIsEb7O0YRaQFsQR6qB++BRp8N9FU+Wpk3dnwPj0vJmYN3YvhMNSMCZt3lzJNlAs3zbkrrOi7vEJD9rNm6Nw45s5bzM7ELzA2N1MZxFTLqSFCfrhuY/gfD2MmrpiB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767848874; c=relaxed/simple; bh=tE1aQ8gNZYs8xPuJM9kx6/765WYYP1SfzbkObKgrR88=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=r75j/+DkXLPGowkr3IT8yyMJKLgZ9crN9K2HViU0rswy63TTc2YOmXrdxudwhCjxjB+IZaZJ7yXQ250w9uIsFU4xx8R1BZrQlVZ0RkQ0+TCR5LARjJSKzFEfg4g4lw3DRpyHy6LuitoVXs1rwcJRfuvkV+aHLuJDu2sho38giyg= 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=cHuiKz3O; arc=none smtp.client-ip=209.85.161.74 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="cHuiKz3O" Received: by mail-oo1-f74.google.com with SMTP id 006d021491bc7-65747f4376bso6055016eaf.2 for ; Wed, 07 Jan 2026 21:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767848871; x=1768453671; darn=lists.linux.dev; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=B0VNCFFD6rMDix3svYgMGRaPMGUEIYmv4wVFO1Dxy/o=; b=cHuiKz3Olu3PCsZVB7VsvoAnCIs/liCZsdPo+S5LT/Ga8RWW3kYQGbzfJeXTBKsJSq 2PznefINIRhQ8t8/cz7aFsWhpSG3b3k9cwqW7sENwLfU53io3sk0JDNMLiHEueLvQDYK s1iUDl3gR3niX7doTU9QYiet7K1EGkIfPfnEKuPFdezShu2eLVEYbidXjF0PKRrUZfbm Pi9pNc0B/J/XASMfzu5/SZy3hkeekr4PtS+cPVrsVURqVTWgRgPxM/AGrJQr5qctA2yR H9OlAS/g9RGwe5YA9BYFTCRgwImq8OLlINJQnkc24zkXh821K8hgrUzWu02+4RwCbg1R TRAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767848871; x=1768453671; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=B0VNCFFD6rMDix3svYgMGRaPMGUEIYmv4wVFO1Dxy/o=; b=d/MQz+Bzv5kA6kOaEqpw7/mqu+m88NZ8EIUFJCmupXWyiMmCJWTF/Ebx2XCxupS5K3 AqdV+jvZ6jC3lQwV/D+mzkzKf6RwbX7mYVTtAF9q01v+FfjY9lz0AIBFvTk2fryGSNYu M99fbpHxnpPdkd+9gLX6NeZdQV5gJZ6tfBIJiD609pkCKi8qSUnXhoSeq/aMb7d8xnDA 5bGMcdNVpNVNiHQy6atogK9fSMHnzTk2Xj+l8pcm+2DPpqWhkMaUCD5vIxVdvQp6ytm1 BN/RF6CFrw8EWuMy0AUQb+ZzPB48xzVMZcPGpliD05l5FDUcAK+yNt0J69d1kZBjuZKB idww== X-Forwarded-Encrypted: i=1; AJvYcCWhNNJE5OhdvtYabLvtnJDe0/GAhvaAEoEYOmbAtKsBTeW9A9j+iVrSQMYqNwg8be1e5Ml2@lists.linux.dev X-Gm-Message-State: AOJu0Ywu9HfB0UZ5TuIBV2X1xG4UeSRlOas/chMBpFPVquK5/0351nHD SOwig2e9KTeCrnQg1OKAubQS1IfPVz1r87/V431o169lJ0iNFbAIc3zgEb+vo5PlndnMGauo+QN OacJALw== X-Google-Smtp-Source: AGHT+IHFhgBrHzgkUSk+DJKlBY6YHJjdAJxwOsdN8kTtLoTak/dkQMUOAlEAe06z6JEmnyckm7jGXWgWufU= X-Received: from ilbee12.prod.google.com ([2002:a05:6e02:490c:b0:433:7cff:208c]) (user=avagin job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:1624:b0:65f:27dd:f565 with SMTP id 006d021491bc7-65f54ee9984mr2161961eaf.22.1767848871676; Wed, 07 Jan 2026 21:07:51 -0800 (PST) Date: Thu, 8 Jan 2026 05:07:45 +0000 Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20260108050748.520792-1-avagin@google.com> Subject: [PATCH 0/3 v2] exec: inherit HWCAPs from the parent process From: Andrei Vagin To: Kees Cook Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, criu@lists.linux.dev, Andrew Morton , Chen Ridong , Christian Brauner , David Hildenbrand , Eric Biederman , Lorenzo Stoakes , Michal Koutny Content-Type: text/plain; charset="UTF-8" This patch series introduces a mechanism to inherit hardware capabilities (AT_HWCAP, AT_HWCAP2, etc.) from a parent process when they have been modified via prctl. 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. Initially, a cgroup-based approach was considered, but it was decided that inheriting HWCAPs from a parent process that has set its own auxiliary vector via prctl is a simpler and more flexible solution. This implementation adds a new mm flag MMF_USER_HWCAP, which is set when the auxiliary vector is modified via prctl(PR_SET_MM_AUXV). When execve() is called, if the current process has MMF_USER_HWCAP set, the HWCAP values are extracted from the current auxiliary vector and inherited by the new process. The first patch fixes AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4 in binfmt_elf_fdpic and updates AT_VECTOR_SIZE_BASE. The second patch implements the core inheritance logic in execve(). The third patch adds a selftest to verify that HWCAPs are correctly inherited across execve(). v1: https://lkml.org/lkml/2025/12/5/65 Cc: Andrew Morton Cc: Chen Ridong Cc: Christian Brauner Cc: David Hildenbrand Cc: Eric Biederman Cc: Kees Cook Cc: Lorenzo Stoakes Cc: Michal Koutny Andrei Vagin (3): binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4 exec: inherit HWCAPs from the parent process selftests/exec: add test for HWCAP inheritance fs/binfmt_elf.c | 8 +- fs/binfmt_elf_fdpic.c | 14 ++- fs/exec.c | 58 +++++++++++ include/linux/auxvec.h | 2 +- include/linux/binfmts.h | 11 ++ include/linux/mm_types.h | 2 + kernel/fork.c | 3 + kernel/sys.c | 5 +- tools/testing/selftests/exec/.gitignore | 1 + tools/testing/selftests/exec/Makefile | 1 + tools/testing/selftests/exec/hwcap_inherit.c | 102 +++++++++++++++++++ 11 files changed, 197 insertions(+), 10 deletions(-) create mode 100644 tools/testing/selftests/exec/hwcap_inherit.c -- 2.52.0.351.gbe84eed79e-goog