From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FE95211A11 for ; Wed, 7 May 2025 06:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746600076; cv=none; b=b9rCPfVjFjEyWmmsGemd9JGECfdHGU6nkb4qcaBjZDdZD5Gq/v6/7M8Dd9F8CqCIk6hb0ATCE/3GjC+TiINdiDuhyLjH3zQhezGiZQ0aT6E/f8VVcT6+nZJYsQVxOPtltojdaDeDqPpOEBwWH6GgNabHcUSYZtaiYzE4JI5bhno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746600076; c=relaxed/simple; bh=r93OQAL+O+DGIdysH+atzMrXTR4OgqwgoeNHguqSrRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CfEWzv0Iibo6eNGqgG+I3uThxAMm87UuI/f4XbRSgyVo1vhxcAV3I/lxUmddRYq6SjHXt7WrEST4EY09iMIR3pjzZlJFP4PWrlejfx5ue6AojlTcn3aM0Cja0cz/ng2hzrKaRwJnsoCNFfFFsXkjXWZJ0CV2bIrL5FyRM6/IGx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NJSNQYpS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NJSNQYpS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746600073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Aq9GfmifFmUJTHzOzR3uh/CPBzOh0qHNI3h7c2rC8V0=; b=NJSNQYpSyMWu1Nrg9fDneJKB7SduRH0QTzgAkxjJD9XLeBn0TWNsM3YCiFibmNkbVqt8BB 57RRzFiwyMFHgIIhk+bebAtFQNa/sk8axxE5BBuxiNI/wEs5fgpyHjJMw4bPPJMxb+01WC SfKuTfd0NSM3+bFuNComo0uMaECJ54Q= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-1tLHEz7xOkC1F-xGVNCVlA-1; Wed, 07 May 2025 02:41:08 -0400 X-MC-Unique: 1tLHEz7xOkC1F-xGVNCVlA-1 X-Mimecast-MFC-AGG-ID: 1tLHEz7xOkC1F-xGVNCVlA_1746600066 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 370001800DA2; Wed, 7 May 2025 06:41:06 +0000 (UTC) Received: from vmalik-fedora.redhat.com (unknown [10.45.224.220]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4DF6F18003FC; Wed, 7 May 2025 06:41:01 +0000 (UTC) From: Viktor Malik To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , linux-kernel@vger.kernel.org, Viktor Malik Subject: [PATCH bpf-next v4 2/4] uaccess: Define pagefault lock guard Date: Wed, 7 May 2025 08:40:37 +0200 Message-ID: <39416cac1d011661601caffc6ac38195c82ede86.1746598898.git.vmalik@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Define a pagefault lock guard which allows to simplify functions that need to disable page faults. Signed-off-by: Viktor Malik --- include/linux/uaccess.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 7c06f4795670..1beb5b395d81 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -296,6 +296,8 @@ static inline bool pagefault_disabled(void) */ #define faulthandler_disabled() (pagefault_disabled() || in_atomic()) +DEFINE_LOCK_GUARD_0(pagefault, pagefault_disable(), pagefault_enable()) + #ifndef CONFIG_ARCH_HAS_SUBPAGE_FAULTS /** -- 2.49.0