Received: by 10.223.164.202 with SMTP id h10csp966334wrb; Tue, 7 Nov 2017 18:39:44 -0800 (PST) X-Google-Smtp-Source: ABhQp+QdwlLQhl1llYJhluxZJJHBVMZPL2i9Nedgigl4zCdiy/cKm/j0nIZkQVSaDnjLyWHexo83 X-Received: by 10.159.252.11 with SMTP id n11mr780659pls.172.1510108784339; Tue, 07 Nov 2017 18:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510108784; cv=none; d=google.com; s=arc-20160816; b=MFzFf9ouDWF6Baib1HupvG1n/KWcx5m+XzpXDT6dLtv1vebFgF81M/gJ9LRjz83PjY kqRCAuefQ5v5UqW0bmTkzm6ud4sSAaWsXFTKcaanNuV6EyWbDkF7CQL/x1oOqsrFddHZ zC2lH/e989rFxO85rEz62gc/BGJLZ5IPszx4+sDcIvcJeeu9ppvCHkhd5EEVU6+jdGrf jZRFl0U4CUOLXgZuTe7nl9/ge8p3gA1osBE1deF9pJo507krdxMZCDSsCCqJWuLimWih o4pPbrrc9E7+9Z0PHGzNiwOOzMzb2n6AGMcIqhUrs/2gjc+xZznkW/YPbcG6gwKPK64K 7W8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=LrQTIcdEpABV73jN9a55B6B5ciZbp+0pf/w9P3KPt8c=; b=wwQdIMSYIYIL6C5N+u3mbvx/cn79Qkv7G4PQ9S9Xa6zs2G2dAduLDXp7hrY04Gp5PA iE0HJApcZEmXJbcvjy4uXzeOzVOTqhhYBwnLL4y/AatbQ6TZW13/u3akmSKgnNThKo8d ylGZdwcRNqjjarJEo7uXTBvv6FZQh6QvZ2PzXVp1YJD/4RR2jTJljsLn12RLD82iMsR7 TLtzIF8wfefxDPAcOVAu+GGOOqxM8H4i6y1feth/wxXgGfFYTn1+6rDXI8Hp1HthxWvt uiUkUwjB0IxcMvxJKixiCQUQ7Joqj0xkVjLk33WhPfOGREj3c7VZN/8kmrP+yBqZWeqs W4Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=w+WRC2Iy; 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 15si1072221pgf.326.2017.11.07.18.39.32; Tue, 07 Nov 2017 18:39:44 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=w+WRC2Iy; 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 S933347AbdKGU3t (ORCPT + 90 others); Tue, 7 Nov 2017 15:29:49 -0500 Received: from mail-qk0-f169.google.com ([209.85.220.169]:45313 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933196AbdKGU2r (ORCPT ); Tue, 7 Nov 2017 15:28:47 -0500 Received: by mail-qk0-f169.google.com with SMTP id c16so679396qke.2 for ; Tue, 07 Nov 2017 12:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=LrQTIcdEpABV73jN9a55B6B5ciZbp+0pf/w9P3KPt8c=; b=w+WRC2IygBZaq/YShBkpPqgK6hVS8t3pr4k+AYISncZ2XhrmcTzS2I9diJqRj+KbUe iw5JuQphVIxxXxwNQBwLCanGbCEPXgi8LAOcmScbDIfLqviHc55apocHG5+Fgezy+ZL+ 6WgUz6XEVWpR77WMb+l1Zs362/v8j1hX9VYcrE+RHMjz4eXxKN25OaHJ7qzrEA499wSP ovUx4cpSAdfVb/Ztvwq5gzz+T9hDi9qS6MXhOAfXwPDHp8YeADNp6Gdt4mMRJEQkoHYw HEC5V7oXZo1kJZyIfoWPFcjuEZ42/RxVfik0zYhoAA0kKwtEOBrARLbqkarvwbB4wMjO 9Gug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=LrQTIcdEpABV73jN9a55B6B5ciZbp+0pf/w9P3KPt8c=; b=VitpJOqixYdb0wYJi/zoTtlwvjA3gOVXtk4Yfi5jkUnCcI5dxpf+s6CFyY4vZR/dDm ZUA0BDbV7BVpM/kOnLUnsYbFFhIH6bs7Y9FzpxEstKhgWak8cAPPboi2HIzwPg4TBJJv CwTEfVUXf9to9dr/hNnU65xeDKB17Zcf4Ditew0UoeVRl8exivuzsU3HuAOAP/LZdOF6 uSnJhHqUwnIrnGEAV3S1lRgnNRtcR0hpH5kC/2G2LfhOsFlacRLFzU++czlHRUnwbhH1 Ze+1J3rw7LyHhj+bN6zcBGtvJKuyUuJ0xAje/0pqUWWO12pp1Cv7I28VAa/xU94l8T5/ f7rA== X-Gm-Message-State: AJaThX58ZY1WX0jNWxKycKgTtWLnMF4AS4xCWZocOgUTyHJMxtynqrDA /YFYN1jzm4eAQFdQL7Ahsdy7DSn6Jnc= X-Received: by 10.55.41.206 with SMTP id p75mr14252090qkp.207.1510086526296; Tue, 07 Nov 2017 12:28:46 -0800 (PST) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id b45sm1475828qta.89.2017.11.07.12.28.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 12:28:45 -0800 (PST) From: Josef Bacik To: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, kernel-team@fb.com, daniel@iogearbox.net Subject: [PATCH 0/2][v5] Add the ability to do BPF directed error injection Date: Tue, 7 Nov 2017 15:28:41 -0500 Message-Id: <1510086523-8859-1-git-send-email-josef@toxicpanda.com> X-Mailer: git-send-email 2.7.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm sending this through Dave since it'll conflict with other BPF changes in his tree, but since it touches tracing as well Dave would like a review from somebody on the tracing side. v4->v5: - disallow kprobe_override programs from being put in the prog map array so we don't tail call into something we didn't check. This allows us to make the normal path still fast without a bunch of percpu operations. v3->v4: - fix a build error found by kbuild test bot (I didn't wait long enough apparently.) - Added a warning message as per Daniels suggestion. v2->v3: - added a ->kprobe_override flag to bpf_prog. - added some sanity checks to disallow attaching bpf progs that have ->kprobe_override set that aren't for ftrace kprobes. - added the trace_kprobe_ftrace helper to check if the trace_event_call is a ftrace kprobe. - renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this value in the kprobe path, and thus only write to it if we're overriding or clearing the override. v1->v2: - moved things around to make sure that bpf_override_return could really only be used for an ftrace kprobe. - killed the special return values from trace_call_bpf. - renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if it was being called from an ftrace kprobe context. - reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state. - updated the test as per Alexei's review. - Original message - A lot of our error paths are not well tested because we have no good way of injecting errors generically. Some subystems (block, memory) have ways to inject errors, but they are random so it's hard to get reproduceable results. With BPF we can add determinism to our error injection. We can use kprobes and other things to verify we are injecting errors at the exact case we are trying to test. This patch gives us the tool to actual do the error injection part. It is very simple, we just set the return value of the pt_regs we're given to whatever we provide, and then override the PC with a dummy function that simply returns. Right now this only works on x86, but it would be simple enough to expand to other architectures. Thanks, Josef From 1584693250765135879@xxx Tue Nov 21 16:20:52 +0000 2017 X-GM-THRID: 1584693219602724553 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread