Received: by 10.223.176.5 with SMTP id f5csp2366151wra; Sun, 28 Jan 2018 19:00:24 -0800 (PST) X-Google-Smtp-Source: AH8x224ryDuHzURcJH9lD2DDSOQg2S8OT7g+wLNyJVkm1QgxNaZqZfKoqM7SIom/bpyaSz69pP7H X-Received: by 10.98.71.197 with SMTP id p66mr25503002pfi.3.1517194824363; Sun, 28 Jan 2018 19:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517194824; cv=none; d=google.com; s=arc-20160816; b=CgidPtWBTNKJTcNcvFmoNbIJb9CNq8Zws3If7K0oO+ZcBi4yaCz5ISaoIcK7phmYci a7OyEbanNTLl6goPZ1VzdBSIP3vl7BAZOgyym5w/Ebmpr3846IUxYNHYKSiP1GoKW03K cFluOJTnJChKbINxYrC9cviMKLk5XG7+A84lKtIlhJWmBqv5UJDcqcNXqedklAouR+SO DJ2htwT9JiZfOwhswRKfgFSWUVjOMqLMYMeBkKfXrczgUthVS+unzO4bbAqtElkT1i4R pmJlwIcYdBNPmLgNCbdpGAXkEx0+RZkbKeknI5X3UTzQeKR8hbkqw831L1XuL63Vj3Bg y6kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=6QjUye/OWc+Pjeze6IffDwDDl3J5DlYwLWExPMiH6os=; b=NsVjmU3OcuvPqINgCpd6Nfw4IfTFwSEUzehBzxXw3zedbzsfPlKwSt60ziuZTvQICZ tPwjmAOgyyjufEbxTp2CmApZYHL+MxRiHrxPfTsY7P+XpC1hXCdfGKB1A6YKEXfSvD4i n29lw3xOfkJ3aj9C0SeaeOoSdN4nMSxfFMc/3YIuPU/IZR9qC6NWuzaCbJ0ZeYx05zqI R4lZFpvEU6izPJLZxW5hDTrlEcNybJAi6eyrnC2p3+ltxtuqldO3nNu7FtLf/Z/vtey3 2JLdYPY5B6QSEQt7bo/+y2p3ic6g8TjsD0ju2jd6tCNe1sCwY2meAepuv+Ib0xGfF4OW UAoA== 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 s74si1864218pgc.774.2018.01.28.19.00.09; Sun, 28 Jan 2018 19:00:24 -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 S1753756AbeA1Xk5 (ORCPT + 99 others); Sun, 28 Jan 2018 18:40:57 -0500 Received: from www62.your-server.de ([213.133.104.62]:54554 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbeA1Xk4 (ORCPT ); Sun, 28 Jan 2018 18:40:56 -0500 Received: from [62.202.221.5] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1efwZ6-0006RH-En; Mon, 29 Jan 2018 00:40:48 +0100 Subject: Re: [PATCH v3 bpf] bpf: introduce BPF_JIT_ALWAYS_ON config To: Greg KH 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" References: <20180109180429.1115005-1-ast@kernel.org> <606bf504-a39f-288d-11cd-56888ecbc165@iogearbox.net> <1516788431.13558.109.camel@infradead.org> <20180128144504.GB19937@kroah.com> From: Daniel Borkmann Message-ID: Date: Mon, 29 Jan 2018 00:40:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180128144504.GB19937@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.2/24253/Thu Jan 25 02:22:43 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/28/2018 03:45 PM, Greg KH wrote: > 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. Sorry for the delay! There are various conflicts all over the place, so I had to backport manually. I just flushed out tested 4.14 batch, I'll see to get 4.9 out hopefully tonight as well, and the rest for 4.4 on Mon.