Received: by 10.213.65.68 with SMTP id h4csp655975imn; Tue, 13 Mar 2018 16:51:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELvZWDBIEn+T4s7cmoufyc0qqAhDFkJEIH/WeHfLE5ynQJI8Eg/vwi6TwpZMaQbDXDrxIAMQ X-Received: by 2002:a17:902:8341:: with SMTP id z1-v6mr2111878pln.386.1520985068416; Tue, 13 Mar 2018 16:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520985068; cv=none; d=google.com; s=arc-20160816; b=wU+M/VBAgIjL4IotvVKXWetTALmJsK4RLsAFcCGyH+xcdapKK1yQHJZauM+JD3tKC0 q7jXfB+Oeydg4E3UcJm1ck9S4xRmdsJ2p0aj9VRnbQAQ+ycR5PTp+FE9QdZo909MUA/i x4eL0XdXEN7RsZNWpvJzYUiU7zeWY0Ow0vbjk626ZEFAM/FoioSYrgsUt0hj25eHNdAe fF9bJsejbQng6Go5bFLmKGiDX8BS0GwJfccK99hlI1g1PHpCQf9DWyad7LjoY3jutE54 FeT1PssCMl0xh4gZrliEGWapJjtUAevhTLoV/pYEBtouCbeYATr6R7np/fTmZwxuROfy hrxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature :arc-authentication-results; bh=zTpUXhYJfnDG9hlkFxu9Lkxw4tBZ2jJIapGZjZYycIw=; b=TnIW7G96olmzvYi4L7I7+iYOdlJ85rDwlnoFnPwib6jYJQc3sc0FHEtKYuEoSUit3B CuJ6cWaCHTb9oLf6PhEIAx3VSR/mU1Rm39TF5PQKNoo2A2Mdo+x20qu6bx5tmLccaIM5 /67g5NVd4t2Lw9U90w+NuYekzeiIC8N6uSQHthA4VOq74J7qCTYmcsemxxDq4zZTOqov YcYWJ5tVZc0N6Q8WRhCZXmPnIKLIlWENsanhtsrC1ISGZVlWIHuhxU34u2OA/Z0KZ738 R3vKxyMWTshTxBeuc2+dO2K28spoV0v0pbMoA00Wp2et82KxSMckU95vsQNyBvjcr1mk 6ldQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Ir3TYbFy; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=NXUpsd9Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si910240pll.549.2018.03.13.16.50.54; Tue, 13 Mar 2018 16:51:08 -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=@fb.com header.s=facebook header.b=Ir3TYbFy; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=NXUpsd9Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932767AbeCMXuB (ORCPT + 99 others); Tue, 13 Mar 2018 19:50:01 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:41392 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbeCMXt6 (ORCPT ); Tue, 13 Mar 2018 19:49:58 -0400 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2DNjPqf025484; Tue, 13 Mar 2018 16:49:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=facebook; bh=zTpUXhYJfnDG9hlkFxu9Lkxw4tBZ2jJIapGZjZYycIw=; b=Ir3TYbFyxuJ8qHsNMqMR/kni4AuKzSyxq/7wtAk/M+bxgyN+e+daa0ZWm78mHiE9l7Ux 01BnFCvgkzYx6lIyWyQsoCT90vF9GeLep9QM4KBPPuoPezb41Z2Qk1nKMxbZ/ka4EAkJ 3W/FyESgjN+c5IbZs1aqBs08hNQ/to0ZNCE= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gpps40b3b-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 13 Mar 2018 16:49:44 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 13 Mar 2018 16:49:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zTpUXhYJfnDG9hlkFxu9Lkxw4tBZ2jJIapGZjZYycIw=; b=NXUpsd9Q7+SEYuA7QQjz3B47G8ctRXbqKovWkbs9mrbS6a0WHDbgtSfpxX6F0k9friicjt+Gd49W26Bvtul+2k4eHuZ5CcPIl38d2TeTtn0E/ZWqBML1JAmJLdksCvNXfas9KS1gZlVcPmM1P3hiqp4VlFOeSSAMRVnURNdFL4I= Received: from dhcp-172-26-117-37.DHCP.thefacebook.com (2620:10d:c090:180::1:3fb9) by CO2PR15MB0075.namprd15.prod.outlook.com (10.161.86.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.15; Tue, 13 Mar 2018 23:49:34 +0000 Subject: Re: [PATCH] bpf: whitelist syscalls for error injection To: Omar Sandoval , Howard McLauchlan CC: , , Al Viro , Thomas Gleixner , "David S . Miller" , Thomas Garnier , , Steven Rostedt , Ingo Molnar , Josef Bacik , Alexei Starovoitov , References: <20180313231627.1247-1-hmclauchlan@fb.com> <20180313234509.GA4981@vader> From: Yonghong Song Message-ID: <67172932-df1d-5585-601d-a7ce70a2c86b@fb.com> Date: Tue, 13 Mar 2018 16:49:29 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180313234509.GA4981@vader> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c090:180::1:3fb9] X-ClientProxiedBy: MWHPR06CA0027.namprd06.prod.outlook.com (10.174.172.168) To CO2PR15MB0075.namprd15.prod.outlook.com (10.161.86.153) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae348f97-314b-4946-a09b-08d5893d1393 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:CO2PR15MB0075; X-Microsoft-Exchange-Diagnostics: 1;CO2PR15MB0075;3:JTB0GgCiqZEdv03dDnYszhlGjtMJlgYWLLzaPtTncgkTUauPAZfHhDRa97UcGiETB1NNGMJp2HOixy/N3IuFbNDBFXzuU7l+IdrIBpa4QRKX60ummI+1LUgVmMm5zsVbA+GR5sfwvDgHNQXabDOeKeUPrL919DCPlZFbUYkhPHUAnkrBNXnM8D34ST3fnl6LDa3YM66rDlXfssP37Mg4i6Qu/xu1ntO8LudeCZw3HmfqtiJwcaf1o9+m/7dQ58iq;25:7t1343rLvYVFEN6NQ1PNWQrLd2HPKW5s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6HCfMnf31dBUeXasJ+2jqevstjUmYIZ7yeVG4+eSY+Mt+fy8+dtRbpKYrYvHeRHxsU9;4:m96FW3INlVqXUz7k/Dmfl2OzGAPpNIeP7991ggaq4CMCpMiCWjKwp9tYbwPUsTF36LLMXsymzcsH70mdytt8J5j3p90bnlDiuVI2MkQVW1wbdsu9DO0/7XRzw4bIdPMYjz40S2GyASovKwcKKiCIDfazKk6kbzEzM457jyGS6QbTU+0urNBYUXE4c06NDPCaYDgkdvqYbaGHmpyLR+j31gh4dAeB7cVpCm8nIesUg3JEUpfJ9MhVOWgf71LXj6Fek27Ye8w/tvTDUaLnXgttGX8NQIugUb5Ll7ICDidHhgSExERnThld1TJb21pOmckn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231221)(11241501184)(944501244)(52105095)(6041310)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011);SRVR:CO2PR15MB0075;BCL:0;PCL:0;RULEID:;SRVR:CO2PR15MB0075; X-Forefront-PRVS: 0610D16BBE X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(39860400002)(39380400002)(346002)(199004)(189003)(110136005)(106356001)(305945005)(229853002)(2486003)(86362001)(31696002)(7736002)(54906003)(52396003)(23676004)(8676002)(81156014)(81166006)(46003)(8936002)(53936002)(6666003)(52146003)(6116002)(52116002)(316002)(4326008)(2950100002)(67846002)(6512007)(2906002)(58126008)(76176011)(36756003)(478600001)(6636002)(6246003)(7416002)(31686004)(186003)(65956001)(25786009)(65826007)(65806001)(64126003)(6486002)(16526019)(105586002)(97736004)(50466002)(230700001)(53546011)(68736007)(5660300001)(47776003)(386003)(6506007)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO2PR15MB0075;H:dhcp-172-26-117-37.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDTzJQUjE1TUIwMDc1OzIzOjZqQitQd0pua0RtQlZGd2pXVWYzRk5xTEZ5?= =?utf-8?B?M2VvYmZ0OVVjRkZyQ0VrVXNOaGMxYjBQZU9tdmtVaWJTN1JBd3J1SzArejJ0?= =?utf-8?B?aTBPOS9LcUFDaHVyZkF2V0hHRWpiSjQzZWRnMWtDTjBFbE5LdWZzVzZNK21F?= =?utf-8?B?ZVZPZXcwd0dtOHhQR1VuYlpnZi9ON1NzQ3F4NElZclFxc2dOUmdzbmhvbXlG?= =?utf-8?B?dFVEaHh3SjZKU24vY2FaYzhTZXZMLzVPSFMrZUhDM1E1NHg3NS85eXBBUVZh?= =?utf-8?B?NEFhTmlLRFBTd0dmZk1DK1NaNkJTKzROZ0FRbHVVT2VFMWZlRU5TTmFESHUz?= =?utf-8?B?OFlYN3BnRGw5eUZmNkRrNERadEw1RGEvT253YWRPODVkWnhwTFdhNHlmUjBL?= =?utf-8?B?TnNTZzVmbmhyQnV0TTNWclIxWkJETDJNOVEwdSsrQkZad1pqZDkrMU04VmpD?= =?utf-8?B?T2dURGZyWkFtVGFjNXh0U0p0dWhxaXQzQ1B1aWVHS1IwOHlmZEJRQnVEYnZi?= =?utf-8?B?TGU1dDBiSDd5dk8zQlp1OERtdElrWFNMTTh0NnZqM2lJdkN2SHNkR01zSjE4?= =?utf-8?B?K2x4dzlyVmNzanh2cE9peXIxa0VpSlFFQU0ySkxZMFhWSlhKcEFFaUJzTkdH?= =?utf-8?B?clJ6Mm1DT3RVM1VCTmRlZUN3RDRhQ0RqTlJjdlVEa09id0hqRFo5aWsvK0ZQ?= =?utf-8?B?QWxTUUZ0aVB0aVpoRkU3VUFzaldHREd6cEk5b3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HcBr9D1LoBPNn+iEfATkM=;24:xtishVqNhLT9p76dOCr0a0pwKXvRXWESpDEP9jIKVlJQ1vJs0OmRYdAiE7dUP191LR9a7giSiUaraf0iTNQnCr608JGSZPKgMBs9HawLnnQ=;7:wixs+mrQfayV1dqVb/MRE0aRtT1RYY9/s2mvYFYUxKYmDqML/vlCkRvdI8DyUpdeLnl1O2xFr0L/Q1XEDU0H25q1Alk3UnlELjAHWEY7VSq5GzIaEc0MoYno/q3TPI5avFy5vKjoTnwMwdj8DASUmn5766zXZyY/81eYazwp5fA9eMXTAGItEKbwJDZUW+4zRI4ocL8QAVJqdTaBiZYgejw1KzjgpZobu+AXiL4rnq58YWPx1RZnQvaljKa6ipfO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CO2PR15MB0075;20:NVLKu9rJeIPd9cp/rd/TrzJcleSPDM6CNpFKqPXCpzn69GeHsLWDKoXoQC7HXeSnLF80b3gZKXhMfjQcfy72+hpM+4NwqKoX3dAVV0+VrfLmpyp4/MyGPGHsLPctW1j3R493mGm76JEXwDP/g6rCzsKSpPDWqv9cRCVIXpmPwZc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2018 23:49:34.7714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae348f97-314b-4946-a09b-08d5893d1393 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR15MB0075 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-13_10:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/13/18 4:45 PM, Omar Sandoval wrote: > On Tue, Mar 13, 2018 at 04:16:27PM -0700, Howard McLauchlan wrote: >> Error injection is a useful mechanism to fail arbitrary kernel >> functions. However, it is often hard to guarantee an error propagates >> appropriately to user space programs. By injecting into syscalls, we can >> return arbitrary values to user space directly; this increases >> flexibility and robustness in testing, allowing us to test user space >> error paths effectively. >> >> The following script, for example, fails calls to sys_open() from a >> given pid: >> >> from bcc import BPF >> from sys import argv >> >> pid = argv[1] >> >> prog = r""" >> >> int kprobe__SyS_open(struct pt_regs *ctx, const char *pathname, int flags) >> { >> u32 pid = bpf_get_current_pid_tgid(); >> if (pid == %s) >> bpf_override_return(ctx, -ENOENT); >> return 0; >> } >> """ % pid >> >> b = BPF(text = prog) >> while 1: >> b.perf_buffer_poll() >> >> This patch whitelists all syscalls defined with SYSCALL_DEFINE for error >> injection. >> >> Signed-off-by: Howard McLauchlan >> --- >> based on 4.16-rc5 >> include/linux/syscalls.h | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h >> index a78186d826d7..e8c6d63ace78 100644 >> --- a/include/linux/syscalls.h >> +++ b/include/linux/syscalls.h >> @@ -191,6 +191,8 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event) >> >> #define SYSCALL_DEFINE0(sname) \ >> SYSCALL_METADATA(_##sname, 0); \ >> + asmlinkage long sys_##sname(void); \ >> + ALLOW_ERROR_INJECTION(sys_##sname, ERRNO); \ >> asmlinkage long sys_##sname(void) duplication of asmlinkage in the above? >> >> #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) >> @@ -210,6 +212,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event) >> #define __SYSCALL_DEFINEx(x, name, ...) \ >> asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ >> __attribute__((alias(__stringify(SyS##name)))); \ >> + ALLOW_ERROR_INJECTION(sys##name, ERRNO); \ >> static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ >> asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ >> asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ >> -- >> 2.14.1 >> > > Adding a few more people to Cc >