Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2612562imm; Sun, 24 Jun 2018 00:11:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIdgM7mcobB8mNxh33cIfjAkCTtC1P4TrIsGdiiL7ik4S7xUiy6UIOd7xCCR6wzhLunQdb+ X-Received: by 2002:a17:902:7d84:: with SMTP id a4-v6mr7696853plm.139.1529824302836; Sun, 24 Jun 2018 00:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529824302; cv=none; d=google.com; s=arc-20160816; b=FbiGRKIC3p1JYZd/og1DYUB/VyFNHaVm6bVA6qeii4twzKmiKkvYl/tk31h2w2YtY0 UKsoxfwDldzZugJpUYndodiJXg3SkjegbI/tZxead6nSlKMSqY6bVcyKUtMNHH4/UVXR EL8LfEma9nfkA+faTtkKZj2C7q2JRBwIGj6j5m6rqtvJPVw4AHqcAKLnc4GKkEZV54PU wX2FSaICXI4AVLFIX3SE2jjkbmg3PZy0QOLmpNL+FlwoDQG0m0ClWUCUOG8A42Ix3ZdR GkPIvYBCZxIPnnbVxA87RPvP12hDx+myHAHgkUrbWO3t5Qmem/7LIu8Au5V62BG/Kfwm fFJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=JadqS4NVAQqbZzVqaeagxeappN7f8GKFnQFBldKrlWA=; b=nKkE3mixT6sKhG7gGxQpd9eUwm7aZHmDls6RYK6FEUMNLZsBLhdfiWRnuGseMtvDAw P5tb/D3c1GhnuS8KCZGoygm/YUbOV+oSBmO+BfuPfqgUBBdl6IYhCECJkwfvms+0BTpf HIZrblSWjBMJdi9eVsB01W7pPDFM34rVNtHDspBnHF7nzPjkWsgnI4xhUvbgD5Q40lA1 KOO1tRQbRQ1vrNrSfo/fzysJv2Ai9gIqWicBUVN6sfZCpy6TdJ6oE7TminosJVc5Ruit 1L8ndyR4NM21cddun3wQGGIZqkCsWfyeNDC8cgrzpWRYBZFzkm56R7X2Bnzr/GpXjzhD M/mg== 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 e11-v6si11969611pln.161.2018.06.24.00.11.03; Sun, 24 Jun 2018 00:11:42 -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 S1751533AbeFXHJg (ORCPT + 99 others); Sun, 24 Jun 2018 03:09:36 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:44704 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbeFXHJf (ORCPT ); Sun, 24 Jun 2018 03:09:35 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fWz93-0002cc-J3; Sun, 24 Jun 2018 09:09:09 +0200 Date: Sun, 24 Jun 2018 09:09:09 +0200 (CEST) From: Thomas Gleixner To: syzbot cc: ast@kernel.org, daniel@iogearbox.net, David Miller , "H. Peter Anvin" , kuznet@ms2.inr.ac.ru, LKML , mingo@redhat.com, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, x86@kernel.org, yoshfuji@linux-ipv6.org, Peter Zijlstra Subject: Re: BUG: unable to handle kernel paging request in bpf_int_jit_compile In-Reply-To: <000000000000d48c8e056f5b6c67@google.com> Message-ID: References: <000000000000d48c8e056f5b6c67@google.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 23 Jun 2018, syzbot wrote: > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+a4eb8c7766952a1ca872@syzkaller.appspotmail.com > > RAX: ffffffffffffffda RBX: 0000000001429914 RCX: 0000000000455a99 > RDX: 0000000000000048 RSI: 0000000020000240 RDI: 0000000000000005 > RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000 > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005 > R13: 00000000004bb7d5 R14: 00000000004c8508 R15: 0000000000000023 > BUG: unable to handle kernel paging request at ffffffffa0008002 > PGD 8e6d067 P4D 8e6d067 PUD 8e6e063 PMD 1b4528067 PTE 1d433d161 > Oops: 0003 [#1] SMP KASAN > CPU: 1 PID: 4811 Comm: syz-executor0 Not tainted 4.18.0-rc1+ #114 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google > 01/01/2011 > RIP: 0010:bpf_jit_binary_lock_ro include/linux/filter.h:703 [inline] > RIP: 0010:bpf_int_jit_compile+0xc36/0xf30 arch/x86/net/bpf_jit_comp.c:1168 static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) { WARN_ON_ONCE(set_memory_ro((unsigned long)hdr, hdr->pages)); } Qualitee. set_memory_ro() has legitimate reasons to fail, but sure it does not most of the time. So instead of implementing proper error handling, this adds complete bogus wrappers. Hell, set_memory_*() have stub functions which return 0 for the CONFIG_ARCH_HAS_SET_MEMORY=n case. The unlock function is even more hilarious: static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) { if (fp->locked) { WARN_ON_ONCE(set_memory_rw((unsigned long)fp, fp->pages)); /* In case set_memory_rw() fails, we want to be the first * to crash here instead of some random place later on. */ fp->locked = 0; } } Great approach for a facility, which deals with untrusted user space stuff. Yeah. I know. The BPF mantra is: "Performance first" I'm really tempted to make the BPF config switch depend on BROKEN. Thanks, tglx