From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (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 675DE3C3BE0 for ; Tue, 2 Jun 2026 22:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780439364; cv=none; b=si3bhu+ZZ9IL/9U0EBqz6Z0VV4ua6E7JYuBnEZSkYz4I1ua8TV6De2H7h4bJ/yYoe2LrN0dJDzuYneotE8rTAvUOznzGp3x4PjQw43nHqzi5Mw8AxiDr4cFMz6+9xXXmUBsY9r2fx6LzAOIAbMk29dl8UUkcDnxOkKg9irb0nGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780439364; c=relaxed/simple; bh=uCD4hCc4XJ9cLp0cEeWugpV7A+Kjg6CRiPP8rloQDrU=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=fa6NsxLKtcYpoZcnWzRbYJ34s3Eu/EapbimXRIbvqbxVatD0UmHpkSeBNT5FCnG4io2YHXt4L6e8Mw778PJAlQ5H02XS0k7Ah26IKFAlaa8xZFyNZOnPbe8wGsnbO1D+af3ogGcRfwWgmN9WvCc5o6vk/UxHXttA2PlFrAnlzX4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bwbJnAP0; arc=none smtp.client-ip=209.85.128.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bwbJnAP0" Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-490b3637b90so10090895e9.3 for ; Tue, 02 Jun 2026 15:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780439362; x=1781044162; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uCD4hCc4XJ9cLp0cEeWugpV7A+Kjg6CRiPP8rloQDrU=; b=bwbJnAP0x7WFGy2gHA/WCNsUl+cSz/0EFtuqkdU3x0j2KXLhvsKVSttsfwgcyJS+/9 WVtz89ZVEUXpB61eUZ6Crrs8p3kIgkJhCmcK68a31xrDD8MmX6FUPcxXcNZhUyPvdMwd SNOCdZxOXxjTCDNzCyskYF+WrhwgbS0Ov/2sA2EFmxaqu7NAcQd5Yh9NKNfV7THyKWfu y2d7eFohDY5Kk9A2nZx9U7seY/fozfqCVz5mWSpBthpVhBhGqi6QHQNf5s8mnXuxQuuq tewg/KiIxJ9p+KhD/PXhYFy/Tsm9jXSbptd97PbVM0ra6qEDzDx9MkMrMiwBiH/tcD1P Wx3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780439362; x=1781044162; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uCD4hCc4XJ9cLp0cEeWugpV7A+Kjg6CRiPP8rloQDrU=; b=kWYejafNR3cpFYfKuiGsbCKOelAhQAzLczzCx9u829WaSid3Apvd57BK0kaKQ8yCUe LvmScYFKrXquOGwmrZAgCFqwDCMOFfKsrhmzqJGgbueF+X2iLZ++xREf00FpjPpBoevN 24PAmJfTbVrLn0NerhWp9ldMyjze9NXauF9E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SMTP id 5b1f17b1804b1-490b5ed636amr10835505e9.20.1780439361703; Tue, 02 Jun 2026 15:29:21 -0700 (PDT) Received: from localhost (nat-icclus-192-26-29-3.epfl.ch. [192.26.29.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490b612f92fsm3362605e9.15.2026.06.02.15.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 15:29:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 03 Jun 2026 00:29:20 +0200 Message-Id: Cc: , , , , , , , , , , , , , , , , Subject: Re: [PATCH bpf-next] bpf: Replace scratch PTE atomically when allocating arena pages From: "Kumar Kartikeya Dwivedi" To: "Tejun Heo" , , , , , , , , X-Mailer: aerc 0.21.0 References: <20260601183728.1800490-1-tj@kernel.org> In-Reply-To: <20260601183728.1800490-1-tj@kernel.org> On Mon Jun 1, 2026 at 8:37 PM CEST, Tejun Heo wrote: > apply_range_set_cb() maps the pages for a new arena allocation and return= ed > -EBUSY when the target PTE was already populated. Kernel-fault recovery > leaves the per-arena scratch page in unallocated arena PTEs, so a later > bpf_arena_alloc_pages() over such a page hits that -EBUSY, and every > subsequent allocation of it fails the same way. Allocation must install t= he > real page over scratch instead. > > Overwriting the scratch PTE in place is a valid->valid change, which arm6= 4 > forbids without break-before-make. Route through an invalid entry instead= : > ptep_try_set() fills only a none slot, so the PTE goes scratch->none->pag= e. > On finding scratch, clear it and flush_tlb_before_set() before retrying. = The > new flush_tlb_before_set() is a no-op except on arches like arm64 that ne= ed > the break-before-make TLB invalidate. The loop also copes with a concurre= nt > fault re-scratching the slot. > > Arches without ptep_try_set() never install the scratch page, so keep the > must-be-empty check and set_pte_at() for them. > > Fixes: dc11a4dba246 ("bpf: Recover arena kernel faults with scratch page"= ) > Signed-off-by: Tejun Heo > Cc: Alexei Starovoitov > Cc: David Hildenbrand > --- > Acked-by: Kumar Kartikeya Dwivedi