Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp76155yba; Mon, 1 Apr 2019 02:02:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxELH+01y97Zd7d0I2Y5UAxc8TfCKQCuMi4X8nf2kOF6n+Sz2UvzchRYWLUPl0KQxXs8iTZ X-Received: by 2002:a62:6e05:: with SMTP id j5mr63046660pfc.158.1554109339564; Mon, 01 Apr 2019 02:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554109339; cv=none; d=google.com; s=arc-20160816; b=Y4h5eaHetOywt9eRSDXyc2nvPZM/JEQRF2zTvPLFo6RQhGHdqodrssQsKygvVW18E9 OBkae5oqez/UD+YfJ6jlhJzpoxWatxsffMJfV9Em5gogtVvjukKcGPOVx+9/m0FZiLUl HTM7veslzlOU2TehAoO8oBw4gQ/4tLCk+asvQdTg3B0FJa5RHqC1uWHswVAcjMLDcaik urplf+5hX4HKkxpEHDVbhlIUzwaU4V2fZ6CzB2dNAOF3dL/u9xLZ/YvPOBXqiCdh43n0 U/WTBR8tlXM6znCAeQQE4FCmILnq19oKgfwwftZ35pzailB8dRAtEhJcb0QpkIe6IZm7 lr9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=JV8kbG3bZJXWIHJUa5sIN+9r6eDa//Bvg6ulGFo5sXg=; b=JeVW47dnHP85+AMXSqHFM313jQoO2p0WluTF9GSxKsqNtdLtiF5H1PRW2GoEgEn+Yl 4m6JJq+XBTpe/wCCS/a1UL9xmvTu7cw5lPxBWD9OyWJNycFq3DvPePKAnhSXaVUcZ/fP QrrBBNrRafhwYqeAQiGeDccS6vgwhFVrKixcHlqCAXpaKtolFsSsHsQRdcRHOFf6HfLB PWVtnfVny8lmWnPCUy/UwRPTqzSrAvbRumN6y0eAq6brVb+htczAxxpQlcTQ4YQNkQya AUk9ZtsU0FBm9Pa/Ir4gmVYSFNfsAXaMjCWwq4xQF7uoxei/iXHEGT6g9W9gIf5ePLW/ U11g== 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 c19si8343460pfi.230.2019.04.01.02.02.03; Mon, 01 Apr 2019 02:02:19 -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 S1728591AbfDAJBW (ORCPT + 99 others); Mon, 1 Apr 2019 05:01:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:59108 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725880AbfDAJBV (ORCPT ); Mon, 1 Apr 2019 05:01:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 97A2BAEC2; Mon, 1 Apr 2019 09:01:20 +0000 (UTC) From: Johannes Thumshirn To: Linux Kernel Mailinglist , Linux FSDEVEL Mailinglist Cc: Johannes Thumshirn Subject: [PATCH] fs/open: Fix most outstanding security bugs Date: Mon, 1 Apr 2019 11:01:13 +0200 Message-Id: <20190401090113.22946-1-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Over the last 20 years, the Linux kernel has accumulated hundreds if not thousands of security vulnerabilities. One common pattern in most of these security related reports is processes called "syzkaller", "trinity" or "syz-executor" opening files and then abuse kernel interfaces causing kernel crashes or even worse threats using memory overwrites or by exploiting race conditions. Hunting down these bugs has become time consuming and very expensive, so I've decided to put an end to it. If one of the above mentioned processes tries opening a file, return -EPERM indicating this process does not have the permission to open files on Linux anymore. Signed-off-by: Johannes Thumshirn --- fs/open.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/open.c b/fs/open.c index f1c2f855fd43..3a3b460beccd 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1056,6 +1056,20 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode) struct open_flags op; int fd = build_open_flags(flags, mode, &op); struct filename *tmp; + char comm[TASK_COMM_LEN]; + int i; + static const char * const list[] = { + "syzkaller", + "syz-executor," + "trinity", + NULL + }; + + get_task_comm(comm, current); + + for (i = 0; i < ARRAY_SIZE(list); i++) + if (!strncmp(comm, list[i], strlen(list[i]))) + return -EPERM; if (fd) return fd; -- 2.16.4