From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f73.google.com (mail-oa1-f73.google.com [209.85.160.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 920EB21FF4D for ; Tue, 17 Feb 2026 18:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771351274; cv=none; b=nSCE/M48J6Yg/T3RvxbMDiFdzYJLnC6TTCoUjNIOBjxZ2Xv3exLlw7/5ufsuIwd28PfI0YNXYFGoJG0mk1DL5HCMuI2EwFX87fNqLdhcq36kDJjnVAgGjW33xgNN6ZC71qrKZMOd/rgFelhmB3VH1jB8sWL+EDCk+/rpa18hXow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771351274; c=relaxed/simple; bh=TcYoluka6Sotp+G8vXS56Hmvkko0fKSIU6lURxuEfEw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=vC+qh5NUFhqMUKNKUmz9wMh2VPpnNI3dYKWPIwKTmKLlJ1bkDynBoz/yXwE858r6IskBNeehvz9WCv1JPcs2qXaWTLzS9Pf+SFTmnEB4Zc/0sizc95d+2WI7BNc/tlL8KUIyobouMJMrez3LimCKj82ZFoTUaucjRBWZhiBNulc= 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=peQGMBSY; arc=none smtp.client-ip=209.85.160.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="peQGMBSY" Received: by mail-oa1-f73.google.com with SMTP id 586e51a60fabf-40ed781f705so35801656fac.0 for ; Tue, 17 Feb 2026 10:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771351271; x=1771956071; darn=lists.linux.dev; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=gd7itJdvcuV3R3SwarzHanDdlNFzzeUJJAZS/H40Dc8=; b=peQGMBSYrLdzupid0kLl19dbqfVvMP2WyNq3woTOyVgltriQ5hJTsAt1HRkrU4Xymq St+y8wZvtGYfU6Iguwks/ISbd8Z0sGEaDDhIR7HFP4VtX1+46HVS8Ypu/s2wDm5I+ECd QqGsX2/FLn4GvRtPxHyXUea0y/61gCxvM1b29mkOIxWtoVQcwEVS6XPrVl2KIvAyJkXa FoEoPc+6afWRtzdYsb87bkGnJnwoUVLQ+Z0WaM3ikdWn7vnxRUY3v/YhlyXBbeSWYMgV 4fMCPKrfU6+HuupsJLqJH0jv9UjUmC03CCYB42W21KFCAGRSSti7IeuJkLRRHayb3RIW J1Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771351271; x=1771956071; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gd7itJdvcuV3R3SwarzHanDdlNFzzeUJJAZS/H40Dc8=; b=S2GPbJY54BvLDbzzfhrYncwGLjoo+zfp80RRyE4bp9lOK7FX5gIAGA/IYUM9+XSaDb Ail5ocPJ1Ijoni6+6t9dpb6gicqSG1T/vBp4Z4RO9jGXIRC8fJ1QNLJkiqqQ1cDoD6Eq r4vQG+NED5xtC5pf0ECOI2wYhBlmLPM8QHIL20gjINP++s88G1sda0VgFJ4PadxFFiMh tPHDTquMCAdzTEWaCoire0CPKRYmFd0Dwp8jJ3elF8zmRAekNnJ4I3iohi012++03id6 Dh3H37h0UBIJmuHZYT3GmJlhhkgzKmIF72Wfor63W5a56vUe9ILspI/Y6TF0sDuXRMZS vgGg== X-Forwarded-Encrypted: i=1; AJvYcCV5HA0bZwIE2OL3crFpA1499R2YNpk6YlcHEx02Rx2fksdkmhErINB8oOhUyFEwcwEEuKpP@lists.linux.dev X-Gm-Message-State: AOJu0YxLZ72TTQr/0AwvbmKaustQdn/C+JsvKKIuVfmCCNxpRV/cB2xI U1HjZfpAuR0Z0mvKEexVqJiK83GGiizrPsaxg5JK7EB5f03sgB71HSTa0BEPm3leRu83xVoNsob CPy0hBg== X-Received: from jabki4.prod.google.com ([2002:a05:6638:a804:b0:5ca:ff1f:79f]) (user=avagin job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:4b01:b0:679:a4bc:9f8f with SMTP id 006d021491bc7-679a4bca251mr287501eaf.61.1771351271099; Tue, 17 Feb 2026 10:01:11 -0800 (PST) Date: Tue, 17 Feb 2026 18:01:04 +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.53.0.310.g728cabbaf7-goog Message-ID: <20260217180108.1420024-1-avagin@google.com> Subject: [PATCH 0/4 v4] exec: inherit HWCAPs from the parent process From: Andrei Vagin To: Kees Cook , Andrew Morton Cc: Cyrill Gorcunov , Mike Rapoport , Alexander Mikhalitsyn , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, criu@lists.linux.dev, 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(). v4: minor fixes based on feedback from the previous version. v3: synchronize saved_auxv access with arg_lock v1: https://lkml.org/lkml/2025/12/5/65 v2: https://lkml.org/lkml/2026/1/8/219 v3: https://lkml.org/lkml/2026/2/9/1233 Cc: Andrew Morton Cc: Chen Ridong Cc: Christian Brauner Cc: David Hildenbrand Cc: Eric Biederman Cc: Kees Cook Cc: Lorenzo Stoakes Cc: Michal Koutny Cc: Cyrill Gorcunov Andrei Vagin (3): binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4 exec: inherit HWCAPs from the parent process mm: synchronize saved_auxv access with arg_lock selftests/exec: add test for HWCAP inheritance fs/binfmt_elf.c | 8 +- fs/binfmt_elf_fdpic.c | 14 ++- fs/exec.c | 64 ++++++++++++ fs/proc/base.c | 12 ++- include/linux/auxvec.h | 2 +- include/linux/binfmts.h | 11 ++ include/linux/mm_types.h | 2 + kernel/fork.c | 8 ++ kernel/sys.c | 30 +++--- tools/testing/selftests/exec/.gitignore | 1 + tools/testing/selftests/exec/Makefile | 1 + tools/testing/selftests/exec/hwcap_inherit.c | 104 +++++++++++++++++++ 12 files changed, 231 insertions(+), 26 deletions(-) create mode 100644 tools/testing/selftests/exec/hwcap_inherit.c -- 2.52.0.351.gbe84eed79e-goog