Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1773759imm; Thu, 27 Sep 2018 02:13:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV62EGuyiJiaflFR1tYOCtWQzGXYoKhIgCnI/F+7tysN0/tfW9cTUM0a8SvgARpPI8S2n1kVW X-Received: by 2002:a17:902:bcc3:: with SMTP id o3-v6mr10110051pls.202.1538039615981; Thu, 27 Sep 2018 02:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039615; cv=none; d=google.com; s=arc-20160816; b=PuLvjtUJ5ZZ2fBC4E9/l+iPOlmIfgWSlpiMIWxWrnwMcYJzoEMbIhaKLi0MpYT/jEw gYOE25U0ovwKpoKCNilRRv+r9KNu6Cnxm85PEDENhI81BrxlbKTVpAZv1JiuY+kySKrT SkveV70PQirmUAdGFBo+AD7Nh7+vXyIm0taLVN9OEeTYVQJGtMBiKMR0DTSt4MUnfjXN CgV5/HPOWVg1raDIJMsht2dRb2MK0BnxX5pWCFUzi5RyO76+0lrV5WSh9CPY3IhG4sU1 58vohTujFMAlAKt+Om3WR/9CL4uUvT/yDOXcU8jbJO8BrVS1V4BtJe+3oebm/4NoSejR EfGQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=6SQ09Q6fK7jxCAyI9VO2IcevxY8cbcJZsl6iJOQDOaA=; b=K75O5XbuI/uOeHcgOf2HyLa1k2qrqT9Vf/GrtvKx1lifcHf3tkgfcPP0Vy4mlIDxE9 W8Zz3mivSqyFHkXlFDCIqRfBH6i5y3xEgQM/sRQhUBjEWCA42Wi/5/Cc+GJZUYChQBLo OTjP1s4KgKyBflGDjD2oShPjQPKt0IOg9ZZIfnYUAo25jGhMtxEtEW/mv5urA4tEJtUq /hR2ocNqwHCjk0Epm9ity0PWOOGPXozqCom3pyYx0IwQOSJCiJ6MePy2+RhAmwLLBwWB vTG1/2VfFoYYckKn7hX/bU810s3qSNLHarQahUnaVb2a3yBJmZVVPjutm0SdjRose5jA 7JEQ== 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 h8-v6si1701336pli.14.2018.09.27.02.13.21; Thu, 27 Sep 2018 02:13:35 -0700 (PDT) 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 S1728250AbeI0P2k (ORCPT + 99 others); Thu, 27 Sep 2018 11:28:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55250 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727131AbeI0P2j (ORCPT ); Thu, 27 Sep 2018 11:28:39 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6654A111D; Thu, 27 Sep 2018 09:11:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Daniel Borkmann , Alexei Starovoitov Subject: [PATCH 4.18 54/88] bpf/verifier: disallow pointer subtraction Date: Thu, 27 Sep 2018 11:03:35 +0200 Message-Id: <20180927090307.374675294@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov commit dd066823db2ac4e22f721ec85190817b58059a54 upstream. Subtraction of pointers was accidentally allowed for unpriv programs by commit 82abbf8d2fc4. Revert that part of commit. Fixes: 82abbf8d2fc4 ("bpf: do not allow root to mangle valid pointers") Reported-by: Jann Horn Acked-by: Daniel Borkmann Signed-off-by: Alexei Starovoitov Signed-off-by: Daniel Borkmann Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3132,7 +3132,7 @@ static int adjust_reg_min_max_vals(struc * an arbitrary scalar. Disallow all math except * pointer subtraction */ - if (opcode == BPF_SUB){ + if (opcode == BPF_SUB && env->allow_ptr_leaks) { mark_reg_unknown(env, regs, insn->dst_reg); return 0; }