Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756110AbdLTRXJ (ORCPT ); Wed, 20 Dec 2017 12:23:09 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:58196 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756019AbdLTRWj (ORCPT ); Wed, 20 Dec 2017 12:22:39 -0500 Subject: Re: [PATCH v10 1/5] add infrastructure for tagging functions as error injectable To: Masami Hiramatsu References: <1513365176-6744-1-git-send-email-josef@toxicpanda.com> <1513365176-6744-2-git-send-email-josef@toxicpanda.com> <20171219152925.5789309c6c4d27807d42f11c@kernel.org> <7b73cbfa-959f-2efe-8a7c-f9d0b0c2ccaa@fb.com> <20171220161342.44443047f186b7a62efdfe1a@kernel.org> CC: Josef Bacik , , , , , , , , , , , Josef Bacik From: Alexei Starovoitov Message-ID: <5402c8bd-149c-04c2-1e7c-143559c35fe3@fb.com> Date: Wed, 20 Dec 2017 09:22:00 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20171220161342.44443047f186b7a62efdfe1a@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c090:180::c592] X-ClientProxiedBy: CY4PR22CA0052.namprd22.prod.outlook.com (2603:10b6:903:ae::14) To CO1PR15MB0966.namprd15.prod.outlook.com (2a01:111:e400:7b64::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce959b86-685d-426e-b331-08d547ce3146 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:CO1PR15MB0966; X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB0966;3:xpik20edQPECvgYFFsfK9MBhb/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ci5fqsdmt9147AYzwd5ZfvUzEYYj6D2NWFqtQ04dLKv4hJkFZcYc/4TmVAmD41VPFcKGID8SL7Ista3xEDAhBDe5RvusMV1MvMpIrE/iHJuXxF3Q/NcjGClsdPIB4KeTVHLc75Q5EPDYz4I/xxNTYtvGxZ8WtKBRc4TVCOY18IT5f5FcyzSMIJXECvksisaMKRxRawTUc+QEqC7Syio6+IltmPUeQyd406w+H+7ce9chnFUzABZlqn+TVYGzTNGwN2Xko//ajVF4dntMSY8boedZqsTayL+07Zn7IuCsCsp5Y5uZTZYgRrCZTGvn;4:0OYmi+7TNWsesVnA9ivn5/ip8doNXAAvItJhsmrLkhv9I+j45MEe6LsI6eDpDIIXxgECk3hnF5U9h8Lqyg6YyKZos3XfTGwzR+BTnZxOqAjzlz7rdzfly9hX4USQ/hGq2LiCekamJXV8I/OZSvfzggNOrZm6P5aSzXYgEIRk+TbmG9pLjCNe2lXEKtSsy+WmMnLyQO7HBn1NWfFd4MJGLI8NEPduZ5tK2TlHYKkBkuncYqfghVvftpsHpWTCHvVDFo7JohAElsqVcC9QU4GthR0bMxDSad2to9fRkk3O/n3+cYEdqHkIkuLhXy6sDnJTPwHeCcMhmI/fxXnTsfXYAenrSwGgkMK9lwBrpigDba0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231023)(11241501184)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:CO1PR15MB0966;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CO1PR15MB0966; X-Forefront-PRVS: 0527DFA348 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(366004)(39380400002)(346002)(39860400002)(376002)(24454002)(189003)(199004)(50466002)(81156014)(8676002)(2906002)(81166006)(53546011)(93886005)(305945005)(6486002)(386003)(7736002)(478600001)(1706002)(316002)(86362001)(31696002)(6116002)(52396003)(67846002)(64126003)(230700001)(58126008)(52116002)(76176011)(54906003)(8936002)(23746002)(25786009)(65956001)(65806001)(47776003)(97736004)(4326008)(65826007)(83506002)(6246003)(2950100002)(6916009)(36756003)(6666003)(68736007)(5660300001)(229853002)(31686004)(105586002)(106356001)(53936002)(7416002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB0966;H:[IPv6:2620:10d:c081:1131::1437];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;CO1PR15MB0966;23:pkthEjfLL31wscdiJRtg7iG+JleO2yz+l45RB?= =?Windows-1252?Q?Hk1BrcVyKeJkOn+E7+ezYXmtZasTG/sIMkHhY8p+dFtcBfqnk+/gMJsi?= =?Windows-1252?Q?Ourdyda0pri6hntU/lVcWBxIRrkmcwpIbzhPJ/9EaNK7s0Qx+sAIEXH1?= =?Windows-1252?Q?uQ1Sm4cbpwygoMXIPLVAGZWyrO42dud60Y4ERNOfdjJdaNkEDHmrcPBA?= =?Windows-1252?Q?XV63Py78xNOEqQe3jGWjCSv+NQvr3TDgO/kst1NFereoPmrlItGclljb?= =?Windows-1252?Q?Dn4U8/z57aLA/26nCOqdFwyUeRZrFcrGxVhkTFlIQvFbbVzwKliFVLse?= =?Windows-1252?Q?rKW9nXAlYi5ar743ulspSgolILnOmCH0dJLhhr1Gxg2sffT080bYAls9?= =?Windows-1252?Q?tNiHb5mB8lOYkbk31nmLh760CA1xf+eY9cO7pb+YdCcANH9eQOYSUL6x?= =?Windows-1252?Q?DFfph15zXV+g/foKkoAa6zBrRY2glDLjUYtUJnhQqxwUc/5TErWj/NBp?= =?Windows-1252?Q?VLlMwEDzr/JWXPOQAX15ROgsBWw8hGH+lcBrW/48mfE4xr5hvpZkiYNi?= =?Windows-1252?Q?smt27mM73eKr+dnz028kLlGtYk/lT8oZ/M+gf5EBK4wqWDlhhLzAlaIO?= =?Windows-1252?Q?gq2cIjhufBzhxbUmYLT6FAsAO4y0sbopaIeyKpyE5yVSx9+pKCfEPgfe?= =?Windows-1252?Q?YRM5no7oCniw4lI/7+XZDyvdj/WtEilrzy3M42pzR3ECPeCAJjqwRnlD?= =?Windows-1252?Q?VXwu6n7VcTZClIp2F38pv1FTpRPkhowaa+R84k07+0/MER91TXc2dat0?= =?Windows-1252?Q?Y5Bw3yUxqtenrDWKr9bl5Kz2Mg9KX4fApCa5uxd10s5NT6mKb7mz1bHA?= =?Windows-1252?Q?GczPgwqDXxHGwc9fuN6lVk/kL6pSCwk3DiXL3WD25B8bGe4TLEPje2Hu?= =?Windows-1252?Q?2wpXfCs4bVAFYpysCLoGviZjK2YWRca9e5MXRux0gVCgrmTLtAec/Gl7?= =?Windows-1252?Q?6dZJUBTcbXZH6YWjzj41kNZrGyTUgm2LlJnkBnzGdFTeN4Q32LbUEGEk?= =?Windows-1252?Q?BjN1EpMWmJqaNVlftwaKYRuK+0aSORDIsfHY7F9WyeD+jIoP0ZDoXKMz?= =?Windows-1252?Q?T1O0d6NU3aIPyVuLEHRBO3yFJsWI9+kVuX3z/4eo1nDJR8a31+e6SuhG?= =?Windows-1252?Q?6F8d7d0CL47B4ZDYPXiW6DvtyRXzAkTiqKnErq7Qwmr57mBraybFw/c1?= =?Windows-1252?Q?dr8z4k7PMbJ3FyQlNZNyhZQMOAH57ip7CRGD2C1XlRPTnizxHzGSwpL1?= =?Windows-1252?Q?faLKjMN4dHrU+L3/X5XKivMxGRUsHPfE2LOrm7keH0M2VAZB38PfLsGu?= =?Windows-1252?Q?qcbyLX0v/E09Uqdz2Wfz4xK/p7p1aOslu3Z21aft5cnTgeFmvpaMi1j1?= =?Windows-1252?Q?oBj421eqmuvabBAqLqO?= X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB0966;6:gxHEBPSCmIWWi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pEGfHrP/GMC4vT4HBMKLmp4BFbpNuOc32YD2TnTisngtLMY4jeeDfp+3TnriBeDCTvrKRhg/71Sgz0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 17:22:04.1313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce959b86-685d-426e-b331-08d547ce3146 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB0966 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-20_07:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1765 Lines: 45 On 12/19/17 11:13 PM, Masami Hiramatsu wrote: > On Tue, 19 Dec 2017 18:14:17 -0800 > Alexei Starovoitov wrote: > >> On 12/18/17 10:29 PM, Masami Hiramatsu wrote: >>>> >>>> +#if defined(__KERNEL__) && !defined(__ASSEMBLY__) >>>> +#ifdef CONFIG_BPF_KPROBE_OVERRIDE >>> >>> BTW, CONFIG_BPF_KPROBE_OVERRIDE is also confusable name. >>> Since this feature override a function to just return with >>> some return value (as far as I understand, or would you >>> also plan to modify execution path inside a function?), >>> I think it should be better CONFIG_BPF_FUNCTION_OVERRIDE or >>> CONFIG_BPF_EXECUTION_OVERRIDE. >> >> I don't think such renaming makes sense. >> The feature is overriding kprobe by changing how kprobe returns. >> It doesn't override BPF_FUNCTION or BPF_EXECUTION. > > No, I meant this is BPF's feature which override FUNCTION, so > BPF is a kind of namespace. (Is that only for a function entry > because it can not tweak stackframe at this morment?) > >> The kernel enters and exists bpf program as normal. > > Yeah, but that bpf program modifies instruction pointer, am I correct? no. bpf side is asking kprobe side to modify it. bpf cannot do such things as modifying IP or any other register directly. >> >>> Indeed, BPF is based on kprobes, but it seems you are limiting it >>> with ftrace (function-call trace) (I'm not sure the reason why), >>> so using "kprobes" for this feature seems strange for me. >> >> do you have an idea how kprobe override can happen when kprobe >> placed in the middle of the function? > > For example, if you know a basic block in the function, maybe > you can skip a block or something like that. But nowadays > it is somewhat hard because optimizer mixed it up. still missing how that can work...