From patchwork Tue Sep 12 11:12:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Sojka X-Patchwork-Id: 812782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="b2ftD8UB"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xs2Ls4dr1z9s7g for ; Tue, 12 Sep 2017 21:17:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ki8gbRs2Kf39J0dA6z9X67kgWJZWzMw1A2FFZUZi7lM=; b=b2ftD8UB41Lb6J 3d0W6SsaNI19HE44WP1zhd6zQ7Q/Avc+Kdw5JeXXju+/mLnFjymvJmqeiU6tjzbpGyOQkv8wSRv2K wMx3iaisLqsJ+2KvQKHYvEBHdR9C9gmAT6dzikyFzw6nK50b+Ozqh9NaHfZzDSCLI+hiNp6Xz8l8M TWCJ7+vwc7F7bWDTcXlhu6d8JG47KTqL1w2xPARNHomW6ClT+YYyqRe+1zOxLjG53+iGdFrk9e5U7 Y2JLwHJ9kFD651Mto4GAQBF8Y1H3fq0BbL6ekMQ0OkOEZodWjxg3H5CRZRw8pKZt+FaCKfTG26YX5 VMDYVYldF+udct0O6Xzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1drjBa-00081q-CF; Tue, 12 Sep 2017 11:16:58 +0000 Received: from smtpx.feld.cvut.cz ([147.32.192.33]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1drj8i-0004Y1-VT for lede-dev@lists.infradead.org; Tue, 12 Sep 2017 11:14:11 +0000 Received: from localhost (unknown [192.168.200.7]) by smtpx.feld.cvut.cz (Postfix) with ESMTP id 9EF53DC3D0; Tue, 12 Sep 2017 13:13:15 +0200 (CEST) X-Virus-Scanned: IMAP STYX AMAVIS Received: from smtpx.feld.cvut.cz ([192.168.200.6]) by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10054) with ESMTP id X77GKhbZk6At; Tue, 12 Sep 2017 13:13:14 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by smtpx.feld.cvut.cz (Postfix) with ESMTP id F1A40DC3D1; Tue, 12 Sep 2017 13:13:12 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.89) (envelope-from ) id 1drj7x-0008EG-00; Tue, 12 Sep 2017 13:13:13 +0200 From: Michal Sojka To: lede-dev@lists.infradead.org Date: Tue, 12 Sep 2017 13:12:35 +0200 Message-Id: <20170912111250.31576-6-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170912111250.31576-1-sojkam1@fel.cvut.cz> References: <20170912111250.31576-1-sojkam1@fel.cvut.cz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170912_041401_321569_684E63FA X-CRM114-Status: UNSURE ( 8.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [147.32.192.33 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH procd 03/17] Do not disable seccomp when configuration is not found X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Sojka MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Previously, when seccomp configuration file for a service was not found, the service was started without seccomp. I consider this potential attack vector. With this change, procd starts the service as if the configuration existed but the service fails in libpreload-seccomp.so, because the configuration cannot be loaded. This is announced in the syslog. Signed-off-by: Michal Sojka --- service/instance.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/service/instance.c b/service/instance.c index bb766ea..dc7e3ca 100644 --- a/service/instance.c +++ b/service/instance.c @@ -873,15 +873,8 @@ instance_config_parse(struct service_instance *in) if (tb[INSTANCE_ATTR_NO_NEW_PRIVS]) in->no_new_privs = blobmsg_get_bool(tb[INSTANCE_ATTR_NO_NEW_PRIVS]); - if (!in->trace && tb[INSTANCE_ATTR_SECCOMP]) { - char *seccomp = blobmsg_get_string(tb[INSTANCE_ATTR_SECCOMP]); - struct stat s; - - if (stat(seccomp, &s)) - ERROR("%s: not starting seccomp as %s is missing\n", in->name, seccomp); - else - in->seccomp = seccomp; - } + if (!in->trace && tb[INSTANCE_ATTR_SECCOMP]) + in->seccomp = blobmsg_get_string(tb[INSTANCE_ATTR_SECCOMP]); if (tb[INSTANCE_ATTR_PIDFILE]) { char *pidfile = blobmsg_get_string(tb[INSTANCE_ATTR_PIDFILE]);