{"id":833387,"url":"http://patchwork.ozlabs.org/api/1.2/covers/833387/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/cover/1509633431-2184-1-git-send-email-josef@toxicpanda.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1509633431-2184-1-git-send-email-josef@toxicpanda.com>","list_archive_url":null,"date":"2017-11-02T14:37:09","name":"[0/2,v4] Add the ability to do BPF directed error injection","submitter":{"id":72383,"url":"http://patchwork.ozlabs.org/api/1.2/people/72383/?format=json","name":"Josef Bacik","email":"josef@toxicpanda.com"},"mbox":"http://patchwork.ozlabs.org/project/netdev/cover/1509633431-2184-1-git-send-email-josef@toxicpanda.com/mbox/","series":[{"id":11520,"url":"http://patchwork.ozlabs.org/api/1.2/series/11520/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11520","date":"2017-11-02T14:37:10","name":"Add the ability to do BPF directed error injection","version":1,"mbox":"http://patchwork.ozlabs.org/series/11520/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/833387/comments/","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=toxicpanda-com.20150623.gappssmtp.com\n\theader.i=@toxicpanda-com.20150623.gappssmtp.com\n\theader.b=\"G6LmgW/f\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySSPW00R9z9sNw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  3 Nov 2017 01:38:22 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933569AbdKBOhR (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 2 Nov 2017 10:37:17 -0400","from mail-qt0-f173.google.com ([209.85.216.173]:53818 \"EHLO\n\tmail-qt0-f173.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S933366AbdKBOhQ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 2 Nov 2017 10:37:16 -0400","by mail-qt0-f173.google.com with SMTP id n61so6361988qte.10\n\tfor <netdev@vger.kernel.org>; Thu, 02 Nov 2017 07:37:16 -0700 (PDT)","from localhost\n\t(cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com.\n\t[2606:a000:4381:1201:225:22ff:feb3:e51a])\n\tby smtp.gmail.com with ESMTPSA id\n\tq28sm2324793qkq.33.2017.11.02.07.37.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 02 Nov 2017 07:37:15 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=toxicpanda-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:subject:date:message-id;\n\tbh=SdBCqsbcsl/l/lJWqIzCwnLYeOwOs9ievQo4ELrjyQI=;\n\tb=G6LmgW/f5KJ41CP7AHCTAFRZbBxvQeNwI1hAgZmb6zETGn/7AY430qIoyKFkjyVkhd\n\tFz5T8zc1Xbvr8rGOUF8bmVp3hs0bLKABQRNx1O1RiwSr3nXSeP1ub0mfzJPTuLnXs6OL\n\tXMJFRQnmROproAf1BxwhOrHu4Eej26Jn4B8p1pmyabBXzqUdowqpwAOWS/IKE4s2XVjJ\n\tJgWZQ3H46pKXHeAwOI0igOjwjEwXJPfrv3/kyez+214tH64AwEaIy7C4qibvSnDxgTiA\n\tZlVRjHkGX8jk4GJAyd2iuX0r0Us6OrD71z5s0xj/EQ4wKA9zdIwaR5cjCUc/zTZzJVlu\n\tuMgg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id;\n\tbh=SdBCqsbcsl/l/lJWqIzCwnLYeOwOs9ievQo4ELrjyQI=;\n\tb=bEtLpVGg2IZ4UDnAvISqOjNnn/0P2YVEMZ/6lxQPBdlvgtebw0SAv2HASJjlSEJune\n\tx4NJbpmRkSW03k6FY8tXU83aE2ztvCbgjpYZdz651OjYYFAcS14i726ZqLqQwcAITV8e\n\toLIiCTzrC2rAhXuZAlQiXwdgNNYweKS4FxXHEpjDJopco2qUOLNndzsfiGQ8MpJt4O6x\n\tK7Yzn3zTFZnRNsGnW7orQ3B9FlOboHCB9g4qWpntBCVFf+J0OLZTZwB78IE9naGdkFMS\n\tFsB8BbIdd0MCQBsMw4NE3TJEEgx15VOOYpI9m9GQGdqsh773Fm3lQ7KQuZEWUfQAa3zG\n\tOW1Q==","X-Gm-Message-State":"AMCzsaWJlaGQy1O5/kkNJjkNaqIV99Mv3uyJIlOiPvAHcCYr82FjwcBi\n\tWwOg3Ujh2E4UVfRFwa6LQPqejw==","X-Google-Smtp-Source":"ABhQp+S8vuSGl0YkZxS/BQiEk/lLyvR3CsjWIUqLaIIqflBx1lfUvwFBvtudcP2Hjeq0RuXUHiud7A==","X-Received":"by 10.237.37.71 with SMTP id w7mr5192297qtc.299.1509633435668;\n\tThu, 02 Nov 2017 07:37:15 -0700 (PDT)","From":"Josef Bacik <josef@toxicpanda.com>","To":"rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net,\n\tnetdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tast@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":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"I'm sending this through Dave since it'll conflict with other BPF changes in his\ntree, but since it touches tracing as well Dave would like a review from\nsomebody on the tracing side.\n\nv3->v4:\n- fix a build error found by kbuild test bot (I didn't wait long enough\n  apparently.)\n- Added a warning message as per Daniels suggestion.\n\nv2->v3:\n- added a ->kprobe_override flag to bpf_prog.\n- added some sanity checks to disallow attaching bpf progs that have\n  ->kprobe_override set that aren't for ftrace kprobes.\n- added the trace_kprobe_ftrace helper to check if the trace_event_call is a\n  ftrace kprobe.\n- renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this\n  value in the kprobe path, and thus only write to it if we're overriding or\n  clearing the override.\n\nv1->v2:\n- moved things around to make sure that bpf_override_return could really only be\n  used for an ftrace kprobe.\n- killed the special return values from trace_call_bpf.\n- renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if\n  it was being called from an ftrace kprobe context.\n- reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.\n- updated the test as per Alexei's review.\n\n- Original message -\n\nA lot of our error paths are not well tested because we have no good way of\ninjecting errors generically.  Some subystems (block, memory) have ways to\ninject errors, but they are random so it's hard to get reproduceable results.\n\nWith BPF we can add determinism to our error injection.  We can use kprobes and\nother things to verify we are injecting errors at the exact case we are trying\nto test.  This patch gives us the tool to actual do the error injection part.\nIt is very simple, we just set the return value of the pt_regs we're given to\nwhatever we provide, and then override the PC with a dummy function that simply\nreturns.\n\nRight now this only works on x86, but it would be simple enough to expand to\nother architectures.  Thanks,\n\nJosef"}