From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GAPPY_SUBJECT, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C3F8ECE58E for ; Sun, 6 Oct 2019 16:49:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D631620835 for ; Sun, 6 Oct 2019 16:49:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DRCGlzEt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D631620835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 697DA6B0005; Sun, 6 Oct 2019 12:49:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 648796B0006; Sun, 6 Oct 2019 12:49:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50ECF6B0007; Sun, 6 Oct 2019 12:49:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 2A9F76B0005 for ; Sun, 6 Oct 2019 12:49:38 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id C3629180AD804 for ; Sun, 6 Oct 2019 16:49:37 +0000 (UTC) X-FDA: 76013945994.23.stick89_53fca9b12090d X-HE-Tag: stick89_53fca9b12090d X-Filterd-Recvd-Size: 4778 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Sun, 6 Oct 2019 16:49:37 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id c25so23555796iot.12 for ; Sun, 06 Oct 2019 09:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gitR6prE2tnQKW2d8vwg8C75oWlKUdv67rXVU7q0QOQ=; b=DRCGlzEtnAKAXsK/2hn1rAPa+00ur0pwb7bfnsPV4inoX1EZo9f+x/DVaJh3kTSbvi EwRDB6fUbQk1/rsy5egGmgH7bYlcXmGHzRajWercwPT1mZvXWa4HpuUmfY4pFtU0/3IC Somjz9/4ecpl/+/yIkZ7GAORqGj8k8bdBaTZWXsRp4KXVc2ycIcMdGM2IbFKi+Pxg31W kFatCmY+0Dy9QUmOdHaVpCrY2A2KPq+lIYzAbToHi0nxs6dptrLB9wgohM3H3Zr/nZm/ PVEq146Ba46kpeaoXCqP1UbN7ZSRrQsxVJailmMq0xQbY9qTMOUGx0WvMQvJoH86IJJl s7ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gitR6prE2tnQKW2d8vwg8C75oWlKUdv67rXVU7q0QOQ=; b=N4Jx31HNaBkClO0mOx6ASdHB+H1oTbStVRLV8yBsHIzqcJFZzuq7a1flogypEO+DDa ddHEhdzdHX+qdaMJ9HGtOOqV4t5K1lhPdhGIguwKcPS3UIK+wCFWA4fQpWXgN1jDQyFC PMsI3nRXZOs5NSbNIsXalpLPRbE2KUh0Vu3aXG4lOT87+P/10igoB64c58b3W3CAzb1z JHVPudzwfULSJJ9QmbDv1piAmqLC+ISdpI6mzYMgqALutXLKD3kQN9PaabVfkbEcaVRv HW72+S05856t40r+D8MAU6FvtSQDkv2SAueJ3SSKAPngyAJtLwewjru1Zff/VrxMaZGL 3hxA== X-Gm-Message-State: APjAAAWQezmNysTXdJl4OARgtfKsnAuBUul9/dJpHMKDj9L5ixNjX5nN +NUXzy9xIRb2f156zFDYJ9A8OYq0uzFsIDvr4ms= X-Google-Smtp-Source: APXvYqzGZYdzHVT/2p6rnwPtcBhy8+JdFhrM+z5AfNJSgF/qYn5iG9mbEGZsWcc2vspca5ATINmbfjn4WGtO7qG9mW4= X-Received: by 2002:a05:6602:10d:: with SMTP id s13mr12183510iot.244.1570380576506; Sun, 06 Oct 2019 09:49:36 -0700 (PDT) MIME-Version: 1.0 References: <1562410493-8661-1-git-send-email-s.mesoraca16@gmail.com> <1562410493-8661-5-git-send-email-s.mesoraca16@gmail.com> In-Reply-To: From: Salvatore Mesoraca Date: Sun, 6 Oct 2019 17:49:24 +0100 Message-ID: Subject: Re: [PATCH v5 04/12] S.A.R.A.: generic DFA for string matching To: Jann Horn Cc: kernel list , Kernel Hardening , Linux-MM , linux-security-module , Alexander Viro , Brad Spengler , Casey Schaufler , Christoph Hellwig , Kees Cook , PaX Team , "Serge E. Hallyn" , Thomas Gleixner , James Morris , John Johansen Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.005615, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Salvatore Mesoraca wrote: > > Jann Horn wrote: > > > > On Sat, Jul 6, 2019 at 12:55 PM Salvatore Mesoraca > > wrote: > > > Creation of a generic Discrete Finite Automata implementation > > > for string matching. The transition tables have to be produced > > > in user-space. > > > This allows us to possibly support advanced string matching > > > patterns like regular expressions, but they need to be supported > > > by user-space tools. > > > > AppArmor already has a DFA implementation that takes a DFA machine > > from userspace and runs it against file paths; see e.g. > > aa_dfa_match(). Did you look into whether you could move their DFA to > > some place like lib/ and reuse it instead of adding yet another > > generic rule interface to the kernel? > > Yes, using AppArmor DFA cloud be a possibility. > Though, I didn't know how AppArmor's maintainers feel about this. > I thought that was easier to just implement my own. > Anyway I understand that re-using that code would be the optimal solution. > I'm adding in CC AppArmor's maintainers, let's see what they think about this. I don't want this to prevent SARA from being up-streamed. Do you think that having another DFA here could be acceptable anyway? Would it be better if I just drop the DFA an go back to simple string matching to speed up things? Thank you, Salvatore