Received: by 10.213.65.68 with SMTP id h4csp734203imn; Sat, 17 Mar 2018 23:49:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELvOgLBQJlSr36d/ng3g35a49aVtGjZP9YRzAuFng2gA2Wau0BsZptNgEz9/mCqo8zPLqmSQ X-Received: by 2002:a17:902:d886:: with SMTP id b6-v6mr3006066plz.254.1521355756055; Sat, 17 Mar 2018 23:49:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521355756; cv=none; d=google.com; s=arc-20160816; b=NSsMWh0WaQTmub9qO6klfwJAWOUjNcMh7Jg8HMlxjL/eDlKi/lLX0qgITP/TKxfxl0 AIqwCL0rp6SH0S8e6f9/+GNCRSodPqNqnXn1JiyZ1VGq9wx5L/7dWThcvhpUKs7eL+dr UhCC3Tt3DosGL/MO/3OM2+T+O/9xROsV9gXxnAN5+XBkSKr/6lMk4Kg6+Q8EbFSE8Klo uMbVwOHyOSlFBoF6lVSjG3tXfy1X62KSn9YsXf3eCKanTUw+3Z/oNhRoGivyieIh6Ccv mwuYvAommTHFCC7GNLnc+nDDW4+bQX5UJVuWbcB8QbcauobqbuNenIYeRcbIRKwskk6N 7T5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=8etQokmCM6P6v5apDl806I1X+oPhalyYArkycyjxJhQ=; b=wJ94iSDiToRSBBQIHuB5Ro3AYZChhFi+da8GJj9c8qxcOPEnFiQDdUsSPvQjF0hpKj TlwNDhFOzGaC/iDW6Gy8SKdetaqxJA2UdSBKRZfXvm/Oie3WVQ6fKIzMdR0wFaFZxr3s qCUqHmnSQUOTf9giNRWebwcsgFx7JmUaBBcBj56jVdn1Q+7xniPR/XMf9OORTTo0i+/z aD/TV/9g48DZlgQYE97rSs2uY3euaz7w8I9mYkHyFm3anSikJidhd5nuKerIa/iZ/bxT dHQbCE7fn/LZ3dIjznelmKopKxCaeAMrATL/uZPFRWXqJfycDMFWRcSJ7Q3RbKYsm5Vk 8M7Q== 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 g8-v6si6156312plm.120.2018.03.17.23.49.02; Sat, 17 Mar 2018 23:49:16 -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 S1752015AbeCRGsJ (ORCPT + 99 others); Sun, 18 Mar 2018 02:48:09 -0400 Received: from isilmar-4.linta.de ([136.243.71.142]:57552 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750999AbeCRGsG (ORCPT ); Sun, 18 Mar 2018 02:48:06 -0400 Received: from light.dominikbrodowski.net (isilmar.linta [10.0.0.1]) by isilmar-4.linta.de (Postfix) with ESMTPS id B5A342008FC; Sun, 18 Mar 2018 06:48:04 +0000 (UTC) Received: by light.dominikbrodowski.net (Postfix, from userid 1000) id 2138120215; Sun, 18 Mar 2018 07:47:38 +0100 (CET) Date: Sun, 18 Mar 2018 07:47:38 +0100 From: Dominik Brodowski To: Howard McLauchlan Cc: Andy Lutomirski , Ingo Molnar , LKML , Linux API , Al Viro , Thomas Gleixner , Yonghong Song , "David S . Miller" , Thomas Garnier , kernel-team Subject: Re: [PATCH] bpf: whitelist syscalls for error injection Message-ID: <20180318064738.GA22649@light.dominikbrodowski.net> References: <20180313231627.1247-1-hmclauchlan@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 16, 2018 at 03:55:04PM -0700, Howard McLauchlan wrote: > On 03/13/2018 04:56 PM, Andy Lutomirski wrote: > > 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 > > > > Dominik, > > This patch applies cleanly on top of your patch series. Is there anything you'd need from me to get this in on top of your work? Howard, would this form part of the kernel<->userspace interface and therefore needs to be kept stable? If so, this patch should wait until the arch-specific syscall calling convention is agreed upon. Moreover, the patches I sent out already do not cover all syscalls yet. Until all in-kernel users of sys_*() are gone (or at least outside arch/), I'd prefer to postpone this patch. Thanks, Dominik