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 34ED31DA5F for ; Wed, 18 Jun 2025 13:32:46 +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=1750253568; cv=none; b=ikwc5XUMcSerUWqEhP/0rGefzhIuYz4h7fCllGlA2c4YlTVz75GkIkY1ymlSo8XWiwrpACXG0QNsaovqNLBU6swUmEwQZNX4WWcSHiQkdPm/LIBbI2KKjKfcsuSnddB/B24gK+bO8PcclRK1vb3bT5H0XV56IYtzG0ev/l6iLTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750253568; c=relaxed/simple; bh=r93OQAL+O+DGIdysH+atzMrXTR4OgqwgoeNHguqSrRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tzOwZchWW8AqJ5TsmagKwA+A4UTmuO6vHscIgcw/dLmwBE7wT51kwOlwj+f1tAlf2SGfFu1jau7V5NS3hAeU8jLu/fz1pfx3Yx4w6u0TkEHkEwLjeVp+4UvAjpAX+RjINrMG9vlK7WeDroPOFLJ3xGtnO6huB0Qlovlj9xQL7AE= 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=XKfkS7EV; 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="XKfkS7EV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750253566; 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=XKfkS7EViOf3Bb+oq0il4xoD+/vgf1KsjCv5nLh1Spjf6ZSKIEkSLikE9K0zs2Du93V7eA ZNpMdDLL030E6g8+cdiepvhbA1je+WOvJlAP4stH3fcJyBqMeXWV9HAG/5IlJ/pXrarhLQ AcxEXTs9NcwRst3GGvcTGe1VbKunEGM= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-VQKlC20JN5yPRjuWVVJ0PQ-1; Wed, 18 Jun 2025 09:32:43 -0400 X-MC-Unique: VQKlC20JN5yPRjuWVVJ0PQ-1 X-Mimecast-MFC-AGG-ID: VQKlC20JN5yPRjuWVVJ0PQ_1750253560 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C3AE51956096; Wed, 18 Jun 2025 13:32:39 +0000 (UTC) Received: from vmalik-fedora.redhat.com (unknown [10.45.226.177]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55364195607A; Wed, 18 Jun 2025 13:32:34 +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 v5 1/4] uaccess: Define pagefault lock guard Date: Wed, 18 Jun 2025 15:32:19 +0200 Message-ID: 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.0 on 10.30.177.40 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