Received: by 10.213.65.68 with SMTP id h4csp658238imn; Tue, 13 Mar 2018 16:58:36 -0700 (PDT) X-Google-Smtp-Source: AG47ELu5XDrrz+OnapniUqBpKqIHRlBlHjHIdcFszNZ/gCFFtt3WmdPPaepYENKugUwe9OY4TNSa X-Received: by 10.99.173.71 with SMTP id y7mr1933386pgo.432.1520985516778; Tue, 13 Mar 2018 16:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520985516; cv=none; d=google.com; s=arc-20160816; b=gUzKjq+lMPq/0bPdMOnHdNzeGSGJdgIBwqkbr4CwnncWMRs3J+gvsJNGz0JOdvtuub YV/RKRFAFIe/Q10Gh4QPbNQnh+p5Njp4/pB/XRDempkUvThHaRqrX2J+pY5bZ1u69loT RySRWCgJbj+ctchmAih+2jcddVYpHhkR7eBW69Tix6/Q4AigzCBFd+eR4cyLntPVbisF 1ImzOJTVQS01+TNh8XlQc42PKDbuop/pGCL8nm4zfvcxqL8iLu156TssCu/V75dtHRus u9Expr2BQcBWhS1t3kQCtXcyc+SuegsqCc0hVxceRrvzJg5SeKDqUlZ8tkWu/CnD6guL NPYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=1Vt+TPCA6XOyuS9O23Z+XQgjmOhcyIfv+7HtCZHAOes=; b=PEm/k40YgFDgyNTptgmF2aZKfXPBKaYLk9k/JQLh8T8t1/yzT0e1k2fIeViUp4jRH8 W/QJBB2Lt9Jhm4WgDZ6tIq7mRNwaMhJjnNvGJOuU6AyPQ9vDOKgZL0ldyib4nUBhSei/ 058wC7LPvxWIOSMn3jULeQXENl4zmL/eTbQcwiWIxEVopTBMnp2PzHV93geC0wsPd18A i9gdo8OUmUGV7j+qtD0rGXonqE6Ozzxs4RT2WA8LeuYb3ZoAP7Th4xl+LW/z3CwPjLOH JYRYwi12dOTY9bK2tIIT7GCLUyViQwkhFPvu0jXu1H1WEkO4AIKK7jStgap0LeomIj8J tpJw== ARC-Authentication-Results: i=1; mx.google.com; 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 d18si994062pfl.307.2018.03.13.16.58.12; Tue, 13 Mar 2018 16:58:36 -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; 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 S932722AbeCMX5N (ORCPT + 99 others); Tue, 13 Mar 2018 19:57:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:40748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbeCMX5M (ORCPT ); Tue, 13 Mar 2018 19:57:12 -0400 Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A7F5B20685 for ; Tue, 13 Mar 2018 23:57:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7F5B20685 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-io0-f175.google.com with SMTP id m22so2180030iob.12 for ; Tue, 13 Mar 2018 16:57:11 -0700 (PDT) X-Gm-Message-State: AElRT7F7Df9+8ywpplembkkNZiH63nDg/j2bmBiEnkUu04tsd7cIoSOi Bm/piMj5zbscte5x3NNPwKnUQqTccxMKrPEmBcrf6A== X-Received: by 10.107.20.131 with SMTP id 125mr2858105iou.239.1520985431118; Tue, 13 Mar 2018 16:57:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.137.101 with HTTP; Tue, 13 Mar 2018 16:56:50 -0700 (PDT) In-Reply-To: <20180313231627.1247-1-hmclauchlan@fb.com> References: <20180313231627.1247-1-hmclauchlan@fb.com> From: Andy Lutomirski Date: Tue, 13 Mar 2018 23:56:50 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] bpf: whitelist syscalls for error injection To: Howard McLauchlan , Dominik Brodowski , Ingo Molnar Cc: LKML , Linux API , Al Viro , Thomas Gleixner , Yonghong Song , "David S . Miller" , Thomas Garnier , kernel-team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 13, 2018 at 11:16 PM, 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. Temporary NAK IMO. Specifically: > 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); \ sys_xyz() is not just the syscall itself; it's also a helper that's used for entirely silly reasons by various bits of kernel code for quite a few syscalls. Fortunately, Dominik has patches to fix that, and Linus is even considering pulling them for 4.16. This patch will most likely conflict with the final result of Dominik's series. Can you and Dominik coordinate a bit to get this patch or its equivalent landed on top of Dominik's work? It might make sense for Dominik to just add this patch to his series so it can land with the rest of it. Dominik, Ingo, what do you think? --Andy