Received: by 10.223.164.221 with SMTP id h29csp2220182wrb; Thu, 2 Nov 2017 07:38:47 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q0p1/fa7MTXGiCFEHvpfZaJkQi8AIpxueWnQBvNktsP2waoUF/k6pP+ZSdG6soR7CZ10AU X-Received: by 10.99.119.4 with SMTP id s4mr3713018pgc.377.1509633527584; Thu, 02 Nov 2017 07:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509633527; cv=none; d=google.com; s=arc-20160816; b=FnLf145RN1J0H0xgmRX+KFFg86vOZ8SuAJYkthnidBauWar4WkIHQvQjhAG3zZ7XTQ +Iewv7NOncgRD+F6VKH3EjZFDJ+LkFZeKrdKqw0oVsrCef4+Nm/4cGLBdqAknRWdf2R2 TRM1uujp/rLYE3xKCJCVVTvJ0F6ckN2cqHcp3IXP9IpTNsuA5kUMxQZiFyaIelB8x5LP y6Auobxd9HozMsivqLA7yoVCbk0SzeAAvCuM57QqFXcE9kx7xEavdEC3jAnj5BdSGFYe hlPVg2xNBBzaEwrb0cpOQBeDqsTP3ob/sahT7o9H9Z2gu/m4f0ta+tYWerBglVts+gt3 LNXg== 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=SdBCqsbcsl/l/lJWqIzCwnLYeOwOs9ievQo4ELrjyQI=; b=pVHiuRTZBEJO6YDySIPde0M5FMgIdP0VSDp2HF4MZmMkE17YIzITo5gQztk/3GQVmh I4ff/K7qNghnrQ0KiDt0YY6/TemLQRh24gIdm24S3U5ckihAb3pKSeqkfUXnjnb3B+Mo 7h03fWv6iJOuFT9ofIYZLNcZ2Q0PKUofliUSlIABEXaXmQFb+V6nFrO2FhcqYW20VK24 BrHxzRA2SIEe2MZTngUlYgDhJzyt7kycq09HaDKIWJ2aauLPV/PWZXVdEQeqiaNbk43S 9DuMuhiF9yUYtyBgBaThznZcsQ+AnnJb2wFhFGXRKZWev309Ge3HmqdPocWvHTsvjwuh DWuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=G6LmgW/f; 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 66si3830674pgh.503.2017.11.02.07.38.33; Thu, 02 Nov 2017 07:38:47 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=G6LmgW/f; 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 S933604AbdKBOhS (ORCPT + 96 others); Thu, 2 Nov 2017 10:37:18 -0400 Received: from mail-qt0-f181.google.com ([209.85.216.181]:55400 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933458AbdKBOhQ (ORCPT ); Thu, 2 Nov 2017 10:37:16 -0400 Received: by mail-qt0-f181.google.com with SMTP id v41so6356765qtv.12 for ; Thu, 02 Nov 2017 07:37:16 -0700 (PDT) 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=SdBCqsbcsl/l/lJWqIzCwnLYeOwOs9ievQo4ELrjyQI=; b=G6LmgW/f5KJ41CP7AHCTAFRZbBxvQeNwI1hAgZmb6zETGn/7AY430qIoyKFkjyVkhd Fz5T8zc1Xbvr8rGOUF8bmVp3hs0bLKABQRNx1O1RiwSr3nXSeP1ub0mfzJPTuLnXs6OL XMJFRQnmROproAf1BxwhOrHu4Eej26Jn4B8p1pmyabBXzqUdowqpwAOWS/IKE4s2XVjJ JgWZQ3H46pKXHeAwOI0igOjwjEwXJPfrv3/kyez+214tH64AwEaIy7C4qibvSnDxgTiA ZlVRjHkGX8jk4GJAyd2iuX0r0Us6OrD71z5s0xj/EQ4wKA9zdIwaR5cjCUc/zTZzJVlu uMgg== 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=SdBCqsbcsl/l/lJWqIzCwnLYeOwOs9ievQo4ELrjyQI=; b=B4Iq8x9lVfrU/LuE6mxBNh8htCihrzsWzXyZ43wMUk0/oMk0hpRx1aCrAz8qbDy+cw vH5TJvgRb8kl2gvMpNjtCs2CBAbUJehY/4z5AlTWRGses+WKNCtZ5TK/cfx3zbRfrvfB NyHO7bKEKFhxAvKX3ePpXOmOMsTKtGi9p84TR8KGeQZRlgz+sL+FFRA7B952RCEuGnJM vj0qoQXrbLuFUP/sKuCwUKKH5wp8MCnY3ogfj/JdD7TiirCIzbmo5gztZcBQY5Ls0+gb xgX4XwzrdhhYZcGog3AfCPchn4lNr3t8N+9tSa9R+amf77fvCeThFJdwu4nsjNQe/xos M/pQ== X-Gm-Message-State: AMCzsaVYtz+CqnfR7mIzogizoLq24L0Ba+9hREZIH3vUjCNv/jC3oV1Z WJ5wCdI7pcZSgLJz4I5/NL/Izw== X-Received: by 10.237.37.71 with SMTP id w7mr5192297qtc.299.1509633435668; Thu, 02 Nov 2017 07:37:15 -0700 (PDT) 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 q28sm2324793qkq.33.2017.11.02.07.37.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 07:37:15 -0700 (PDT) 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][v4] Add the ability to do BPF directed error injection Date: Thu, 2 Nov 2017 10:37:09 -0400 Message-Id: <1509633431-2184-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. 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 1583371947788846891@xxx Tue Nov 07 02:19:19 +0000 2017 X-GM-THRID: 1583363139528217166 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread