From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f73.google.com (mail-oo1-f73.google.com [209.85.161.73]) (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 AF5A5270EDF for ; Thu, 8 Jan 2026 05:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767848874; cv=none; b=Rh6O1aRaMAyOQTNqwhflH9DdTJFtfmkgAqjQbAoLCbFY5O5OIMY1hQ3DQiUfonWGQwP6+g4WRpJjxKugBRWljhTAqAn3EbO4AeC2zcnSTzD2WDF+to5Mc23V/b4UoKSqLWQNjom+tMKpj5V5SuFWYcQB1v3Ss85IQPhyeU1iJfU= 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=jji3OBLn; arc=none smtp.client-ip=209.85.161.73 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="jji3OBLn" Received: by mail-oo1-f73.google.com with SMTP id 006d021491bc7-65747f4376bso6055013eaf.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=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=B0VNCFFD6rMDix3svYgMGRaPMGUEIYmv4wVFO1Dxy/o=; b=jji3OBLn+29I07G7IHdhglJXZ6mJJKtvVRFddAhDZCbLuHRcgIxiPR6Oa8vdTkUGM0 MqBR0nlVQlCPGr737vI13ggxlbeGlwoXCBLYu2FNAi4etyhsE/ukgFk6jepy4FbolTlz 9QfYLuzcrZUv4TiOsnagu987foid8gV2U2xBLEgRG8faHL/hEsrcnFvMKnPSqmSZxebF G1/YJj2pfHOzArwPIi1g2aOjwp3HObbsxCbh6ZodNjxNrKk2d/YaZX7A4Vo6JpV1lf0P Ph0T4YahX0swD/X04f3RHQiOtVqGqrJDO5kzhA+ldk8ZVj78q2nQPLM1ejPLKR2Q82cM QzBA== 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=l3mOuJgLGrZPFl8a6VDhAUrrFG0zw6JDROt5VrWW+EgwqFn7WdeE/9sEKw8Vrqaa5u /SkuB2EZJnL1PqctXAncZhLOgUPf5STDdT2+NZloxxjmiMCJlIp2DG724FxMocAXG7mR ub3hjAP90y0bXwq/j9fIBsqubMBtPjVEzrmLBHyEzi+NLGcZ3fsLpFv4nFAsvdZTQEg2 4P8SyvMn2RoAPWyqLRK2t1LEmBtrvB0rXHIN6WXMa4uDrhlP1rybRMQUUF4GzscqKnDi oaPuXjdzCGZ8lCKAgfdsOEhAnRVJv+fDVxYK828EPlzT815Twzqm0iwsi8AiT6ncsU0b qAPQ== X-Gm-Message-State: AOJu0YwGA+WzOCHx3C7R7Limc3doJDGxJB4KHzOSrt3ww/owDdVeKbGI 5hpIzLk5w8Du2fFTXrQ+KL4hn3N5Avk3o55fqX+xKU5YsroSWdfIGYWXULpL3xtfq2R38GE+Pk4 lvjp6+A== 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: linux-kernel@vger.kernel.org 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