Received: by 10.223.176.5 with SMTP id f5csp3423069wra; Mon, 29 Jan 2018 12:59:13 -0800 (PST) X-Google-Smtp-Source: AH8x224/AvAFub3bpCrnBw1rK9tO+oB5KiE2CV7l3MlCZfTkt2kf3tIO8Wkal7mb/Yc+v9AXhwbi X-Received: by 10.98.141.199 with SMTP id p68mr27045286pfk.25.1517259553198; Mon, 29 Jan 2018 12:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517259553; cv=none; d=google.com; s=arc-20160816; b=OEPZTGiANTwMcyjvDaXfgZ4S+WJI91u2JjPRAZB4MITLM58vGP65MsAi8po0e6euyQ /zTQH4Qa5Ted/HmllD8K6QeLkjODWqPCzkh56W5HWqRoORLUZo1893hOf989+RpXUXFE bVhyoGGZsNVQ4PGKZpBeaJfB3qkgeyHPTLT73NTMUA4I3D9kUH3QeH5PfQ4gYuOfe1rJ QgQ+dLfZ+j17cndo2aH2bwi60IfM7u5RRn9KvuGAA9lyZ0iU9sDzco0aXfI54q2I1WkV cAki6Ounp6JXB6wtxmGgu7UoCQLkPB/ElyH4Nms8XWwHiHfB0o2FryMJ5YHhD6O5I8PH 2Drg== 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=Fdd9Vax0Im2MVGUOu7+FLYUbZWy5K8qS52BSOGPFwDI=; b=R3D5DRNsKPC7NZfZbqKBxqerlXYXGIMrtyCBPuutSQjLIw9Z5iy6MYkKMGpoWXrc2x cmy2FYjp04IPwoBhhMda/E7RDUwKnqT1aFtgJSObmfp8ZqW6tX8BTobxXEWS4XfbNbzF D0dO57O9+eUpo3HogDUR5W8Sp4UBqgfXojfsP27+L/eIHX1LUZAVZDIDXWBbfcQC9BKP 0CxfjYyde/bVXDy2r06tWrZRVgiFxww2b583DzoqgEIFkSMt0/yRDoiYDHfTSOcC5erv vxRywnj6X3uE8T9loGry98T5d4ilUFsH3FxEPBy7JUQ1+aA+U1euPxm5abISI8oiVw2h Y6Rw== 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 h82si12578562pfd.219.2018.01.29.12.58.58; Mon, 29 Jan 2018 12:59:13 -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 S1753234AbeA2UJM (ORCPT + 99 others); Mon, 29 Jan 2018 15:09:12 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54296 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752128AbeA2UJJ (ORCPT ); Mon, 29 Jan 2018 15:09:09 -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 EA4AC2D1F; Mon, 29 Jan 2018 12:31:11 +0000 (UTC) Date: Mon, 29 Jan 2018 13:31:10 +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: <20180129123110.GB24544@kroah.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> 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 Mon, Jan 29, 2018 at 12:40:47AM +0100, Daniel Borkmann wrote: > 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. Not a problem at all, wanted to make sure I didn't miss them having be posted somewhere I missed :) If you need/want help for the 4.4 stuff, just let me know, and I'll be glad to work on it. thanks, greg k-h