Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2785551ybh; Mon, 16 Mar 2020 09:39:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtToZfHtlUIYSC0YC3RueCSF5HkfaGgVjJB+Ttu5otjxkA8Ku9uFRAuFDIMaJeGT5nRUfm7 X-Received: by 2002:a9d:7a4e:: with SMTP id z14mr152105otm.78.1584376764396; Mon, 16 Mar 2020 09:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584376764; cv=none; d=google.com; s=arc-20160816; b=u2q/Qbonoq1329fqocmxtfYHDObDOz+9st3vtD6jXeIOzU/qyDvQXdqI6TZS5v23DI VRJRD/GFtI5raxw4Au/F5jNjvQZJKM0munLLo0EfRFptMITfaTmxg2bhNr2WEjtv5yiT Tr7dz/HHYeMd9OSKIcZcROoQT20nRKhJC0qwUfH1qZZQobN13Uj0D/3vU0Rf1OcDHMMk wbKqEpOzgZ3dSWN2YLKgQ21lFbANxu9T468brlgC27A0WZ5BrqEArWzV+TEm1JrAME47 Q3AEFbF9bmbzTxkjrLrV8FL6cVL3McKnkGikK9glYPoaBnWkiwP4w7yv2Canj3tBaKXB /anA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3+hUQzi8rSGcD861hLFiFZxEV8fS8e2CK6IX3o7vpd0=; b=rLXuSC+1BFNckk59hEwNgaSuOCG8uQaOZG1u+ecUy7pvZNxvvcCGATCDcrl3ZIW0gA hvYmOf0OiSBv4VND1knYTTw9FW6HkB16E0uZA5LnwwYKVwcck17yaOD4sRZIryUEYhGZ PXWuMacBpda4UkkOGrRSmXZFwZB7XLCYmd02eZlUMo4h6fYo2cYcZX2n5RGw3LGxdeIO gzJMma6EDMUDBUETQoumdkF2ItegivGeZRbd4CchhfSwl7qakfkph+i3T8XpFVTqbBzQ Zw22+TOFb10tos1ghHm4XU/wc224GupL5iqhr7k3XRCCnMZJzPravCHbc9GvAHwh7Qw2 56cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oau0fH9k; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si236456oie.56.2020.03.16.09.39.11; Mon, 16 Mar 2020 09:39:24 -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=@gmail.com header.s=20161025 header.b=oau0fH9k; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732203AbgCPQha (ORCPT + 99 others); Mon, 16 Mar 2020 12:37:30 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:44510 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732198AbgCPQh3 (ORCPT ); Mon, 16 Mar 2020 12:37:29 -0400 Received: by mail-oi1-f194.google.com with SMTP id d62so18413158oia.11; Mon, 16 Mar 2020 09:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3+hUQzi8rSGcD861hLFiFZxEV8fS8e2CK6IX3o7vpd0=; b=oau0fH9kC3YB34GLThPRDlnyCEnY6HDOha1KcXiOv3qrdIVzUHzJRk9k1OOR6Ka6yL j88oQRJF2i5wYbwRGZcnenshtLZH1ISiJwrl70x5A76vF9F3vopXkZUtH5eXKc3vo6W7 EnwaCSCPwicuLe+Vi/SX+LWJsVhIM5upRWWrlLDHo4wE0/9HzT5RwKGgK+WSCgA0palu xjZzmcpf9tnyRBOc8dznz+tkLsIa9aehGS09LOYRKexCGokM+a6/uYxTMQtWWE9usIsY bYdoTkyHqHG994k1w1/Ni+/MjJyK9pl2TlfLMGWFXGHp+5IxIog7kRNv39WxEqavY58V AuIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3+hUQzi8rSGcD861hLFiFZxEV8fS8e2CK6IX3o7vpd0=; b=DTJ+9R7/qVT/NsMMg/3oEW2g92unksIZSVuLpZdUVaat+yKiRGz12hq1Wj6SH8AN+R A2RzpJWu/yPcBNxrViBO3A9wZxrx68lp4Q7zwvxH2h9/d6QQkRAMzWu2ZoDeVtqfQtmu FKGAxV+piqi33Yb1UQWaQ07DCQNeXZifO7rutoIOxuXkWfF38xRH6rhWMiguqwLgyLcX 62FEGkiRO0eEugcvTFDwAAck9HlolOrAtkBcAJZaPSayw+cHPN2ON2VSXhH/YkqTuUQ4 3JMcrSk7y6LgphVD1f82KYS5z+QgDy9uq9N2nTR71TihfjlZKMQpZTFOOzzbS0HNTP3c uBng== X-Gm-Message-State: ANhLgQ1Ww8xVnZkKQxrDpu1itPSXJie5XNcP3WXqqS6127/b4ewV+JfF T7tOYkADzjUHOjXddss1/vg= X-Received: by 2002:aca:1913:: with SMTP id l19mr269031oii.47.1584376648382; Mon, 16 Mar 2020 09:37:28 -0700 (PDT) Received: from localhost.members.linode.com ([2600:3c00::f03c:91ff:fe99:7fe5]) by smtp.gmail.com with ESMTPSA id l20sm115101oih.40.2020.03.16.09.37.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:37:27 -0700 (PDT) From: Anton Protopopov To: Kees Cook , Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org Cc: Anton Protopopov , Daniel Borkmann , bpf@vger.kernel.org Subject: [PATCH] seccomp: allow BPF_MOD ALU instructions Date: Mon, 16 Mar 2020 16:36:46 +0000 Message-Id: <20200316163646.2465-1-a.s.protopopov@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The BPF_MOD ALU instructions could be utilized by seccomp classic BPF filters, but were missing from the explicit list of allowed calls since its introduction in the original e2cfabdfd075 ("seccomp: add system call filtering using BPF") commit. Add support for these instructions by adding them to the allowed list in the seccomp_check_filter function. Signed-off-by: Anton Protopopov --- kernel/seccomp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index b6ea3dcb57bf..cae7561b44d4 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -206,6 +206,8 @@ static int seccomp_check_filter(struct sock_filter *filter, unsigned int flen) case BPF_ALU | BPF_MUL | BPF_X: case BPF_ALU | BPF_DIV | BPF_K: case BPF_ALU | BPF_DIV | BPF_X: + case BPF_ALU | BPF_MOD | BPF_K: + case BPF_ALU | BPF_MOD | BPF_X: case BPF_ALU | BPF_AND | BPF_K: case BPF_ALU | BPF_AND | BPF_X: case BPF_ALU | BPF_OR | BPF_K: -- 2.19.1