Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752169AbbEJXWW (ORCPT ); Sun, 10 May 2015 19:22:22 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:56678 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbbEJXWT (ORCPT ); Sun, 10 May 2015 19:22:19 -0400 Date: Sun, 10 May 2015 19:22:17 -0400 (EDT) Message-Id: <20150510.192217.1306037281172187835.davem@davemloft.net> To: nschichan@freebox.fr Cc: linux@arm.linux.org.uk, ast@plumgrid.com, daniel@iogearbox.net, mgherzan@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits. From: David Miller In-Reply-To: <1431011661-10277-1-git-send-email-nschichan@freebox.fr> References: <1431011661-10277-1-git-send-email-nschichan@freebox.fr> X-Mailer: Mew version 6.6 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 10 May 2015 16:22:18 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1400 Lines: 30 From: Nicolas Schichan Date: Thu, 7 May 2015 17:14:21 +0200 > The ARM JIT code emits "ldr rX, [pc, #offset]" to access the literal > pool. #offset maximum value is 4095 and if the generated code is too > large, the #offset value can overflow and not point to the expected > slot in the literal pool. Additionally, when overflow occurs, bits of > the overflow can end up changing the destination register of the ldr > instruction. > > Fix that by detecting the overflow in imm_offset() and setting a flag > that is checked for each BPF instructions converted in > build_body(). As of now it can only be detected in the second pass. As > a result the second build_body() call can now fail, so add the > corresponding cleanup code in that case. > > Using multiple literal pools in the JITed code is going to require > lots of intrusive changes to the JIT code (which would better be done > as a feature instead of fix), just delegating to the kernel BPF > interpreter in that case is a more straight forward, minimal fix and > easy to backport. > > Signed-off-by: Nicolas Schichan Applied, thanks Nicolas. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/