Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753366AbdL1Ecu (ORCPT ); Wed, 27 Dec 2017 23:32:50 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:53660 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327AbdL1Ecp (ORCPT ); Wed, 27 Dec 2017 23:32:45 -0500 Subject: Re: [RFC PATCH bpf-next v2 1/4] tracing/kprobe: bpf: Check error injectable event is on function entry To: Steven Rostedt References: <151427438796.32561.4235654585430455286.stgit@devbox> <151427441954.32561.8731119329264462024.stgit@devbox> <20171227015730.jjggymg4uqllteuy@ast-mbp> <20171227145628.53f68f391b2108d6df118ca7@kernel.org> <20171228113434.eb182c348fc69853fec934ee@kernel.org> <03e0ebb7-0b2a-4235-3408-c0d59a1ba4c2@fb.com> <20171227231644.168abc0f@vmware.local.home> CC: Masami Hiramatsu , Alexei Starovoitov , Josef Bacik , , , , , , , , , , Josef Bacik , Akinobu Mita From: Alexei Starovoitov Message-ID: Date: Wed, 27 Dec 2017 20:32:07 -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: <20171227231644.168abc0f@vmware.local.home> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c090:180::a7a] X-ClientProxiedBy: CO2PR06CA0059.namprd06.prod.outlook.com (2603:10b6:104:3::17) To DM3PR15MB0971.namprd15.prod.outlook.com (2603:10b6:0:10::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb783895-c4a7-4b9b-4304-08d54dabf7db X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:DM3PR15MB0971; X-Microsoft-Exchange-Diag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bZQxmDOhktR3zvzwHrW1+DcNHFU3GqoLx7NkOhgVmbT5KOf64svS4cNKPCkZtUYvHBvj2ku3va/WEGfepKvUlHaq6DY6MIDvHvfZacVoJZHcBmhaC2+GvuS3fiwMdvRUQ+YllnhLd8ew7lQAQ5zf3kgSKGyWwfl3GymX0wb1/msCP/v4ozopRXEJuNCopFqqz4daKlA/tmlFryZUdKSZiXNdupYjHxxNEZJxK+nVCyENektTj1Cp7j9WAkhgHp5eSVxmhjz3GkJZs14QGtDDgMjGTa9RUDJdk9W0WX8sfuiSua4ez29XrM5wOVZObXY9Te34zVaPpBkvoyVmXmx+pa9zpm5n+zZ71mwtxloY8XJQs1wYijNZP8VVz2I+rNCsH;4:p6BAXr7+u+jpJOz29aG2G6mSQ+qL6CtHHAmpGQVebn0cJfZo1upjaCf32Ctx2pd3PkU6rEFgBh9LH6NGQCJMWOHTlIVA7HafZPC7R3hPl1Zertin8ZoBvpMIMa8MQ2m6COl3bjkvhDw3Y64nUn4zy+MwbV2MZmWKy8470q28ink3AxDTxtAiBMDZOZX1jE8rsMZGtmbD7DbcrLmnQuJ9kaxcLtPGZqIrZA5D+6JNEQE/GsnXwM5/0OkofXweIvG63C2+dvxEGbaC9jpo50fKEzTXEIiU+drxUK0omJaZ2qopjp9KbuR3GN6LisR2j6Nn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231023)(11241501184)(944501075)(93006095)(93001095)(6041268)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011);SRVR:DM3PR15MB0971;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DM3PR15MB0971; X-Forefront-PRVS: 05352A48BE X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(346002)(366004)(396003)(39380400002)(376002)(199004)(189003)(24454002)(8676002)(81156014)(81166006)(6246003)(86362001)(4326008)(23746002)(47776003)(25786009)(39060400002)(106356001)(386003)(83506002)(31696002)(229853002)(54906003)(67846002)(31686004)(7416002)(2906002)(7736002)(36756003)(53936002)(105586002)(53546011)(305945005)(64126003)(58126008)(76176011)(316002)(1706002)(230700001)(6116002)(65956001)(6486002)(65806001)(8936002)(68736007)(6666003)(2950100002)(6916009)(97736004)(5660300001)(50466002)(52116002)(93886005)(65826007)(478600001)(52396003)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB0971;H:[IPv6:2620:10d:c081:1132::1039];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM3PR15MB0971;23:1NZdsOYkselL1eZLwLXuhDW06LqsnshqS0coJ?= =?Windows-1252?Q?MYWTYuJ/ZS7VSXiaPutd5UGQu0TgkBw2uzvyKibVbqCE6XwOZiQLakYI?= =?Windows-1252?Q?u9n3cG3mJRJI0CaX7RRYi480Z7+W+0e+R8lHu4HrXfa9rj785kiE731y?= =?Windows-1252?Q?WIQ2Wb1euKnRlDXriffTup8S3+s9UGUqsI2awY6re2tVAm7p0+/kIkX+?= =?Windows-1252?Q?CotGLjUQkZNp8ClGTfz2HDxq8BZ+wnCD+i92pu1N9Xse57LW0rN2owld?= =?Windows-1252?Q?xKE/LpVnqjNkFLikq/PjcDPcSQyG4xuv46NXaUTsTS68CQTW9rRLjSsr?= =?Windows-1252?Q?W8KuaJfvF+rP4u32kNVXtScaamLQIXIujEAjHCjZK0u12sjg/IRMN/JU?= =?Windows-1252?Q?d65WVzxyCWAuDWOQuvxsHjGYUfIXetYZhmm4KihIoEcXBiTg0ISCLOHJ?= =?Windows-1252?Q?gymzowMGQT0vw9gZ0xDCROHS1Gxt4g3R4vHgNwbNEgE/r6FTasYOYHYX?= =?Windows-1252?Q?RCOswgQQs9xp1t7OWeEpWcJMPGDt8CTATL4aYGVgPmW+z64W99YeMvFW?= =?Windows-1252?Q?fGPqfAX7kwKzYufiv12At0Lj0GpeQmbluubf5vFf7xvNsqshEamKrLrS?= =?Windows-1252?Q?ndxY2dWNeWotY1KOtglh6lVcHU7vAb7PxAfvCCDQX58zNy05evPVDSJw?= =?Windows-1252?Q?0aT2deDueqe/Cukek2SZN55GFdyPt2PZGzkiLG6/+kfMLsNJVpnAjwV0?= =?Windows-1252?Q?YoYP4fjRGep/VGEL9OL9qk4wBRAJKA8uw52wzUqbQuy60Yar8UpQvhyN?= =?Windows-1252?Q?/H/WtAPFxMSQzyLYEcKgd3At2CQTQYBfT2H41ToCPPsMyVqt1wV8sXx2?= =?Windows-1252?Q?2oU0ohzCXoOsLEVTjHHbWzJw2gbzc8co3wiTAxAepPyt7bu/o2BA5qCU?= =?Windows-1252?Q?eRa2sYgbzrT14+9DEyt0B06OUJn2ZuPZBTHJIbqI0OXBCo0quy4uT6nl?= =?Windows-1252?Q?MdT46VvXtVr33/mjTzFS2ZJVr7IHEvL6oo5wnmDzTHnuXpEUE3W0HFdV?= =?Windows-1252?Q?fJY3xNB4ybEHMM7YV/0EWo2h6hq+UQEq3a0+Sz7mGC5g/SBChQXnqWtg?= =?Windows-1252?Q?wpZfL5c4EFwbEez8DJ0E0bIRji4y8eptUv+wswCorR8uZB5sdxxPuWDm?= =?Windows-1252?Q?H8fDKRZaKo2unN2ManbW3jlTz109YDFX1zHT8zARwZV1GHSa9gwiUXrC?= =?Windows-1252?Q?/WwEbVbi7fise5iRVQdFTQWh1Md9RNxp5RhVEAsk5dQbtQ29f5Tcc+6R?= =?Windows-1252?Q?Uu8YJTalk5Nq6cTes3RmrqdXZZphlkWIkdqhBLxPgf9IxruPIFsq/ZOd?= =?Windows-1252?Q?ekHwcm/J/DooyvVRYX6KXxfJp072Tul5zc8N/YbORi5L0d/Jw/0K2vXJ?= =?Windows-1252?Q?3neHkFlsaCPKLVaoy2TM849hpDak0/JyGSn8bEFoq3Qe8VQN9Z0lEkDr?= =?Windows-1252?Q?K2xmcE=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0971;6:CqrXOvi3Mx/FNWRhxXdV9W17+UQ1kQDbiHnsozcjrqrgtDQ8+QimUhg/tL+HNJxq0cmX2VAtp4TpmAVKVCxwUxr+YYqkcftW23yTIE+V4XfQyqcf9rM2IKnj+9I2lGAH9pfh6AB1HschKgdgG0j0dReIsJHB2udo4xf3VkIqyjblZ4ARS5Z2x5zH+bhRgNZr2BuMRzLrT2LUkFHqpE9eKjLoe3Ti/uRLQ4sNf/nEXY5JN98d2rA1lGdLs0WxVEqdVJZkRj/CJmgN292Op5xG1tlEnbMN2GMoUTXzQdMbn4bfZ6cWfPAvOnRMFfLd7ki+Wwr3wRS1/0t+PftiR//bUIfIHCsFF76zLVO1BExqCHc=;5:LrHVJvnXTQDXx76tyEmcGJXak6dyf8P6hC02jysBFt9lOmtr4vkODGBRB01JsAqnYb690UmQmorquINvxu6sa/wUvICzH1Aln57/G6haWwBnQR05RDjsY6JBsBjg4fybdV6KOjpLIotNtag7D8SOQ905GbY+1ICiaCcF50ocDV0=;24:VWfS42b0go8JB9K4Ltr2TaEexJr0p5hJ4pvnciIHo6JgXyWBq9lSbJh18D8OPBVQoxXzPTT5p0qJ8EgsJ7GJO7lQc0S8R6WTyLhmd8glQ7o=;7:+2F2bGAqXS8M/wup8po02IgDW6ZMmiUQmhxDAUl0U//xwbQ0Lj928FaLyZw88boc8ydK0wjSdVlWQ9aRc3a0n+wQp9i85z28BAKsrH8389GbdpneoLwCg7dDc6sLigj73dgif69qqUzx3dfjFqpVGEIZLb4V2IIvkSw6U1v3e09U+qJPa7UUxsCZXYkhaV3oip/SbOENlZuveqLEy8k2oMpsQ/1XXqpXX+Bqy+8riISoSoZ9BYu1YmOxG/cTRpLn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0971;20:MxReEk9c1/RAt+Gvq6Da84Btc7nfxZ0FN17SflOosX89NaIFajQ2AZnisBK1zMRRxQ5j7Qdxds7dIfNtMAXgGyZYEBzX01P2tErSqb5c8ObmML6YIRKoG3H07xXnjJBdeWs8CmHtEKTTKfmRQxuV/v3zFVHd/gmYDck/EWXVEVQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 04:32:12.0568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb783895-c4a7-4b9b-4304-08d54dabf7db X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB0971 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-28_02:,, 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: 1676 Lines: 36 On 12/27/17 8:16 PM, Steven Rostedt wrote: > On Wed, 27 Dec 2017 19:45:42 -0800 > Alexei Starovoitov wrote: > >> I don't think that's the case. My reading of current >> trace_kprobe_ftrace() -> arch_check_ftrace_location() >> is that it will not be true for old mcount case. > > In the old mcount case, you can't use ftrace to return without calling > the function. That is, no modification of the return ip, unless you > created a trampoline that could handle arbitrary stack frames, and > remove them from the stack before returning back to the function. correct. I was saying that trace_kprobe_ftrace() won't let us do bpf_override_return with old mcount. >> >> As far as the rest of your arguments it very much puzzles me that >> you claim that this patch suppose to work based on historical >> reasoning whereas you did NOT test it. > > I believe that Masami is saying that the modification of the IP from > kprobes has been very well tested. But I'm guessing that you still want > a test case for using kprobes in this particular instance. It's not the > implementation of modifying the IP that you are worried about, but the > implementation of BPF using it in this case. Right? exactly. No doubt that old code works. But it doesn't mean that bpf_override_return() will continue to work in kprobes that are not ftrace based. I suspect Josef's existing test case will cover this situation. Probably only special .config is needed to disable ftrace, so "kprobe on entry but not ftrace" check will kick in. But I didn't get an impression that this situation was tested. Instead I see only logical reasoning that it's _supposed_ to work. That's not enough.