Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.231.201 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796100141; b=mqQG7KKplqJ4UAowO1h6xLkSZCoqPVv6vCKNHOu43VvGIgwbL4uXmbezQsmA4nDbAlUR jV+FnIpsF+x7DZqD7JL5aptDKBrYtq9blVDpMG4eLkwyQQhxxgAPaMv/szLO0IOOGbORO xh7Tzs3ZI+KfH5npftF5uhBAWj8RJv4wzNM96DLOj+9QCWuJcnCu8JPVaxYwjPMHRqM73 4QTky3Wron85kSq1ai1a3ZHD9uleB8NUPxos+oAn2DM1uRw4+ItTMt/7e203sjdwBNcet r6YsN6wLOWPzI9VoGF417VMtLBNDFHM/PxiO39sOQb68nL11dHmvhowfCGPLJtMziZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796100141; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: X-Developer-Signature:X-Developer-Key:Content-Transfer-Encoding; bh=jBUsDP3HkUxumB79fH7iH10mH1GH0IjxXHSRBaUg/QE=; b=K4WuAI21FilmnsUQ3bINS4qTy4dj5T2P9VYz22V9IpNUkmhcAQoPeSbxyargJa8wjhxX BW9maw7oK+6pUuTD6Zb2BPqIaHDn5El6jtJSGNpgaHdJNvrLdBPq2bU3cBjja7BM++fYe SUXBTnKHPw9k5IHVv965i2kY2LPbO1jCX75va20wf+eyPtB+f6BFH9FT6T7p6aEgW+Fnb wAF1Dzczkq3LVes1A0cp6ldistiHVe/v6Ap2+Rt8DUYYf1rgNcIX63ls5IyUJ06SFBpiH Jr6b/1wRwBoix5ypMrYU7RSoHvsk1wWfynHOcIFsp6GTJeR8ZGWl1+ZssZEXrcNWv6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=me6N0VLg; arc=none smtp.remote-ip=74.125.231.201 Received: from mail-oi2-f9.google.com (mail-oi2-f9.google.com [74.125.231.201]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47A56606A31A for ; Tue, 1 Dec 2026 04:42:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47A56606A31A 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.a=rsa-sha256 header.s=20260707 header.b=me6N0VLg Received: by mail-oi2-f9.google.com with SMTP id 5614622812f47-4f61e12e8e0so1360977b6e.0 for ; Mon, 30 Nov 2026 20:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796100140; x=1796704940; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jBUsDP3HkUxumB79fH7iH10mH1GH0IjxXHSRBaUg/QE=; b=me6N0VLgYBMGJvF+rafqNsa7js6hRAL7BchWOps6CQ7jOkF6SgoAXnPBQOV8fG80hO 9vXrEqUrFIihqBXblzhGtqyIZkq66WH1j8IapfY6Rco2wN7EvqHbxoZWuod9mxAJHeDb ANTB6DwOlZ1J/0mkNFUVDT9f5Putj+sx/4Hv0/rpmTMeqvPiYkhP0QSylhw3tQjE2s+d 8CkSNAtAyaS+8utAbDrb6aGY2BtvU1UyhbbnNDhUsqAM+oZ2Ggeww9dN4ja9nAHJsrRh ipgu/J3SgDSW3SrSBoZ3m/hontl5wV/a1BrYhXSmctqYQkH4MxLjtyTtcXMqrMFcPTn/ lyVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796100140; x=1796704940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=jBUsDP3HkUxumB79fH7iH10mH1GH0IjxXHSRBaUg/QE=; b=ShKVhC4ypPMSSo895zgEVAkSPFrKsJlEBY2H2rANUg4yY2u6K8Y0xREXkv2l2AHelR HFWI8vOzfmQksDOCnPf1kpZMqADKvZ6QJaS/zQPXcEzlocNY1ml7MUhXbSk7LmtvRHoa 1C4XG1dQhpk+P9bO0BCAlgBojwNZd19e9Kyrv5ZMwL0Rp1NLrzS3WpEmzlKR74D6YhDs rsUWHUdNVqn7L2ghoXyEOrne/U3T2TFPNmVEDllclrTY6s4bEdrR6SW5G1zHDluv531h 3j3M3COLkpOxadxDqp0g86V2T9zqtonDEg2KxUNoyCdrIuF7XIaztu5eDgY9OwuupvdW jNfw== X-Gm-Message-State: APuU4Z97iauzYBHyk7qJ3jqTS4W/TT4t2WNoaMzaV5zKE2MPoTeFpZre aCIz3WZDibYSfDx3iN58gZ8WtAbi6+kYFgFbyaJWVl5TXDU2PUWxB6XaY6hebZjpE/c= X-Gm-Gg: AZFdTZfVqgUg/dyPq2eLt74wKINw2KpRkoFl7fRXwSOFf6ut4y7ZTDvZ36QwzUBcVsB 5riwN6REhoGnJ4Qwr69f7GLpxgxNehstmkLNrJ4VnCgpGaVlHztjR2nKsZKgXOr9cbWC5IVpJft S0+du1ihLSIQWYAeeYZpmq6Ga9/i5HWaygrIM5eu/eh8sdbtzhmJWUxbuF+jaowBh85qvqGABLB pGwEkY0O6LncCbTlrJM9JdV5P8EZYU7vuwdW1nspXHS9+P9cVFeIAIBYFDlxQM5SwWilqmkbAmb F2gwRAlDeoaKrK8sjyA9oCy3batWrZvDsqbNtzROXSlJ6TFwmGjYv36hCHrzU7rFm3M9NbfQtno 5EFz5XtBO2jD0350ygNy3e1WBeIYcedNhDwBQHn/X0qhEPpPApjLIG3GleIff7bgj94hXc5uosu f6dfMKizTq9N4OoMi+cu3rorXVzuaz7jOOVlBy2vjpoDbmlA+FOcx0T2j+i55a8WaZUvp+0Lnmq /PjFzlJN/+H8fsuo0OBdlWtf8voMS+EK4Kblj3BGr7Gr2nqzqozuhBa1EjGtsLdcZ8bQrCEaJ2A JhyzoWWwukcZdEEa193RMvi57BnjVmpAPS7bkpiyTxF6jMq5IhKvFLAbAj5wIKsQhH1ry2vNPsn /e8mzi712SRdJDFp2D5QbFnJOjafpGMqt/+Y3 X-Received: by 2002:a05:6808:50ab:b0:4f0:1f76:8ca0 with SMTP id 5614622812f47-57a0be9d917mr37905404b6e.56.1796100140289; Mon, 30 Nov 2026 20:42:20 -0800 (PST) Received: from localhost ([2a03:2880:10ff:5b::]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a31929223sm26706532b6e.1.2026.11.30.20.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 20:42:19 -0800 (PST) From: Kumar Kartikeya Dwivedi To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Eduard Zingerman , Emil Tsalapatis , Ihor Solodrai , kkd@meta.com, kernel-team@meta.com Subject: [PATCH bpf-next v1 45/73] s390/bpf: Remove the exception boundary Date: Tue, 1 Dec 2026 05:39:12 +0100 Message-ID: <080d6c27146fdc871f1d9310ed2df195f5d06b4e.1796099738.git.memxor@gmail.com> X-Mailer: git-send-email 2.53.1 In-Reply-To: References: X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4494; i=memxor@gmail.com; h=from:subject:message-id; bh=8EV6jk7w6oi72nR/GCITuPuMx9ugu05X8bxKGO24DHo=; b=owGbwMvMwCXmrmtenRyi38x4Wi2JIZvPb6GF/lkXQ7vKdUUvlZ3Nfq3lcnjquTdx9gEWsej9kkZO QYkdpSwMYlwMsmKKLCX/9zEZn6j8HWi7jBtmDisTyBAGLk4BmIj+VkaGd3xvGdrM5RzudLBn3ri3eD Y787kORk3dwrlW7WfLak5YMjIcOqcZHXzD7cnySV9fSQVrVRiHnzu648KOXNbTy6Y9WZbLBwA= X-Developer-Key: i=memxor@gmail.com; a=openpgp; fpr=B34BD741DE8494B76E2F717880EF20021D46C59B Content-Transfer-Encoding: 8bit From: Alexei Starovoitov The s390x JIT still has the code of the exception boundary, which served the stack walk of bpf_throw(). A main program that could throw saved %r6-%r15 in each invocation, used or not. The exception callback switched to the stack of that frame and restored them in its epilogue. A call of bpf_throw() is a jump to a landing pad now, and landing pads need unwind_exit and unwind_goto in the JIT. The s390x JIT has neither, so the verifier rejects a program that calls bpf_throw() there with "JIT does not support unwinding" until the JIT has the two insns. Nothing sets exception_boundary and exception_cb of a program any more. Remove the code that reads them: NVREGS, and the extra_regs argument of save_restore_regs(), which is 0 in all remaining calls. arch_bpf_stack_walk() stays, because BPF streams print the stack with it. Signed-off-by: Alexei Starovoitov Signed-off-by: Kumar Kartikeya Dwivedi --- arch/s390/net/bpf_jit_comp.c | 38 +++++++++--------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index d6c3c4270a0b..5d3cfa3fe49e 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -62,8 +62,6 @@ struct bpf_jit { #define SEEN_FUNC BIT(2) /* calls C functions */ #define SEEN_STACK (SEEN_FUNC | SEEN_MEM) -#define NVREGS 0xffc0 /* %r6-%r15 */ - /* * s390 registers */ @@ -517,9 +515,8 @@ static int get_end(u16 seen_regs, int start) * Save and restore clobbered registers (6-15) on stack. * We save/restore registers in chunks with gap >= 2 registers. */ -static void save_restore_regs(struct bpf_jit *jit, int op, u16 extra_regs) +static void save_restore_regs(struct bpf_jit *jit, int op) { - u16 seen_regs = jit->seen_regs | extra_regs; const int last = 15, save_restore_size = 6; int re = 6, rs; @@ -533,10 +530,10 @@ static void save_restore_regs(struct bpf_jit *jit, int op, u16 extra_regs) } do { - rs = get_start(seen_regs, re); + rs = get_start(jit->seen_regs, re); if (!rs) break; - re = get_end(seen_regs, rs + 1); + re = get_end(jit->seen_regs, rs + 1); if (op == REGS_SAVE) save_regs(jit, rs, re); else @@ -633,21 +630,8 @@ static void bpf_jit_prologue(struct bpf_jit *jit, struct bpf_prog *fp) } /* Tail calls have to skip above initialization */ jit->tail_call_start = jit->prg - cfi_get_offset(); - if (fp->aux->exception_cb) { - /* - * Switch stack, the new address is in the 2nd parameter. - * - * Arrange the restoration of %r6-%r15 in the epilogue. - * Do not restore them now, the prog does not need them. - */ - /* lgr %r15,%r3 */ - EMIT4(0xb9040000, REG_15, REG_3); - jit->seen_regs |= NVREGS; - } else { - /* Save registers */ - save_restore_regs(jit, REGS_SAVE, - fp->aux->exception_boundary ? NVREGS : 0); - } + /* Save registers */ + save_restore_regs(jit, REGS_SAVE); /* Setup literal pool */ if (is_first_pass(jit) || (jit->seen & SEEN_LITERAL)) { if (!is_first_pass(jit) && @@ -699,7 +683,7 @@ static void bpf_jit_epilogue(struct bpf_jit *jit) /* Load exit code: lgr %r2,%b0 */ EMIT4(0xb9040000, REG_2, BPF_REG_0); /* Restore registers */ - save_restore_regs(jit, REGS_RESTORE, 0); + save_restore_regs(jit, REGS_RESTORE); EMIT_JUMP_REG(14); jit->prg = ALIGN(jit->prg, 8); @@ -1973,7 +1957,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, /* * Restore registers before calling function */ - save_restore_regs(jit, REGS_RESTORE, 0); + save_restore_regs(jit, REGS_RESTORE); /* * goto *(prog->bpf_func + tail_call_start); @@ -3096,12 +3080,8 @@ void arch_bpf_stack_walk(bool (*consume_fn)(void *, u64, u64, u64), break; /* * addr is a return address and state.sp is the value of %r15 - * at this address. exception_cb needs %r15 at entry to the - * function containing addr, so take the next state.sp. - * - * There is no bp, and the exception_cb prog does not need one - * to perform a quasi-longjmp. The common code requires a - * non-zero bp, so pass sp there as well. + * at this address. Pass the next state.sp, which is %r15 at + * entry to the function containing addr. There is no bp. */ if (prev_addr && !consume_fn(cookie, prev_addr, state.sp, state.sp)) -- 2.53.1-Meta