Received: by 10.223.176.5 with SMTP id f5csp1707108wra; Sun, 28 Jan 2018 06:45:57 -0800 (PST) X-Google-Smtp-Source: AH8x227Fjp0sq+/dGLEIfnbX8NAM+MzcBr4GU3vB5vTiG7DyhIEn2kMSUk4pP/Xgm1xS4mQHQnyf X-Received: by 10.99.165.87 with SMTP id r23mr19420572pgu.93.1517150757381; Sun, 28 Jan 2018 06:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517150757; cv=none; d=google.com; s=arc-20160816; b=T2mDLxrsNSdSTT24dwfU7sUjujHxaba/zsdttaUZDSm9IIr9TvVtDhrYyUOnLRlPGF zBO4AtIngoC2sjUYWgPlHKKtYdMVOtDqvrjf2DvYfviGqZER35cdU0+AbqyjkT2uoelN raqikDBehaBoHSkIfAuyRUx+/4DXrfI1du0GlHxVLwpU90Fgnq9RwZa+lSPW4vk1dPtP k7KbbFNvTl9W0DD0+J9NCKxA4rmlx7qa2wab9uTzsYqstLE3TQNf1jtK1/eP15R41XWE zmxwHh5aqatt/JLeQtWHyojEwVKK1GDmMitn3md0QwIG1r9CcDh0Pj0zmoGcGpdu1hxW d/mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=jqqoj3c83zulVBBAVNub10lhycA3kyqFMX9itFXJeWY=; b=Yc+XHnN2FN1oNpRcnn/EmMRWdVmdBnezvNfmFGd+CsGlzibLsSbrdttnTFVa9y3MqB t5wTikm3nXzzayB212RJl40jcgFALPGEF5nsxpMfQhwKipY6xOv7GmPIZYGAQbrHfXf9 okq6ti3rbx4fQmjh6UpES3ALXDrerlw1em88JWRiJao5RdYdSZ5cyAyyCKyOXsDrfkVW y/eauDDq/a/0GCE4LfsY3qsQz/qcsWIoSjpjB/pwxBsUii6rxGmkqo+KrP16qDZqBe/q DH95Avsg619xQ3VNFysSENi+XmDs0hOZ11bgwUSUaT16Mjvdt/3/4fuztqAbvUGLV3Eg 1bqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2-v6si7108101plo.811.2018.01.28.06.45.42; Sun, 28 Jan 2018 06:45:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751971AbeA1OpJ (ORCPT + 99 others); Sun, 28 Jan 2018 09:45:09 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38958 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbeA1OpH (ORCPT ); Sun, 28 Jan 2018 09:45:07 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 81ECA1029; Sun, 28 Jan 2018 14:45:06 +0000 (UTC) Date: Sun, 28 Jan 2018 15:45:04 +0100 From: Greg KH To: Daniel Borkmann Cc: David Woodhouse , Alexei Starovoitov , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, "stable@vger.kernel.org" , "dave.hansen@linux.intel.com" Subject: Re: [PATCH v3 bpf] bpf: introduce BPF_JIT_ALWAYS_ON config Message-ID: <20180128144504.GB19937@kroah.com> References: <20180109180429.1115005-1-ast@kernel.org> <606bf504-a39f-288d-11cd-56888ecbc165@iogearbox.net> <1516788431.13558.109.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 11:10:50AM +0100, Daniel Borkmann wrote: > On 01/24/2018 11:07 AM, David Woodhouse wrote: > > On Tue, 2018-01-09 at 22:39 +0100, Daniel Borkmann wrote: > >> On 01/09/2018 07:04 PM, Alexei Starovoitov wrote: > >>> > >>> The BPF interpreter has been used as part of the spectre 2 attack CVE-2017-5715. > >>> > >>> A quote from goolge project zero blog: > >>> "At this point, it would normally be necessary to locate gadgets in > >>> the host kernel code that can be used to actually leak data by reading > >>> from an attacker-controlled location, shifting and masking the result > >>> appropriately and then using the result of that as offset to an > >>> attacker-controlled address for a load. But piecing gadgets together > >>> and figuring out which ones work in a speculation context seems annoying. > >>> So instead, we decided to use the eBPF interpreter, which is built into > >>> the host kernel - while there is no legitimate way to invoke it from inside > >>> a VM, the presence of the code in the host kernel's text section is sufficient > >>> to make it usable for the attack, just like with ordinary ROP gadgets." > >>> > >>> To make attacker job harder introduce BPF_JIT_ALWAYS_ON config > >>> option that removes interpreter from the kernel in favor of JIT-only mode. > >>> So far eBPF JIT is supported by: > >>> x64, arm64, arm32, sparc64, s390, powerpc64, mips64 > >>> > >>> The start of JITed program is randomized and code page is marked as read-only. > >>> In addition "constant blinding" can be turned on with net.core.bpf_jit_harden > >>> > >>> v2->v3: > >>> - move __bpf_prog_ret0 under ifdef (Daniel) > >>> > >>> v1->v2: > >>> - fix init order, test_bpf and cBPF (Daniel's feedback) > >>> - fix offloaded bpf (Jakub's feedback) > >>> - add 'return 0' dummy in case something can invoke prog->bpf_func > >>> - retarget bpf tree. For bpf-next the patch would need one extra hunk. > >>> ? It will be sent when the trees are merged back to net-next > >>> > >>> Considered doing: > >>> ? int bpf_jit_enable __read_mostly = BPF_EBPF_JIT_DEFAULT; > >>> but it seems better to land the patch as-is and in bpf-next remove > >>> bpf_jit_enable global variable from all JITs, consolidate in one place > >>> and remove this jit_init() function. > >>> > >>> Signed-off-by: Alexei Starovoitov > >> > >> Applied to bpf tree, thanks Alexei! > > > > For stable too? > > Yes, this will go into stable as well; batch of backports will come Thurs/Fri. Any word on these? Worse case, a simple list of git commit ids to backport is all I need. thanks, greg k-h