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=-8.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,GAPPY_SUBJECT,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 30346ECE58D for ; Mon, 7 Oct 2019 12:40:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E93DF2173B for ; Mon, 7 Oct 2019 12:40:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dDiR8orV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E93DF2173B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8719A8E0005; Mon, 7 Oct 2019 08:40:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 821F78E0003; Mon, 7 Oct 2019 08:40:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7100D8E0005; Mon, 7 Oct 2019 08:40:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id 513D38E0003 for ; Mon, 7 Oct 2019 08:40:41 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id ED1A28243763 for ; Mon, 7 Oct 2019 12:40:40 +0000 (UTC) X-FDA: 76016947440.04.bite05_5e903fd99712 X-HE-Tag: bite05_5e903fd99712 X-Filterd-Recvd-Size: 5083 Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 7 Oct 2019 12:40:40 +0000 (UTC) Received: by mail-oi1-f194.google.com with SMTP id m16so11498013oic.5 for ; Mon, 07 Oct 2019 05:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4omqkgEsOa3d7dDrSHEj0fGIcb4u6Z71IZA7jxrxpXA=; b=dDiR8orVa3DeLfGPRt48FE0G85MRTPusWnInVoCHTm00UIfVXwiV/+Te1Locr2IaNc MzWbl8tv0imbIGqQtxu0ALEcZC1N9Or2EThj5AmzPSVpmoDMVs1i8SsmJ9wVcwlzZkYN qBxVgOHEYzZGQe/JFirWQ3b6bW9Kri0w3T2G2dSxfyxekUK0in8Zjncbv0YSi1etbce0 JUNEKfAP/FqN5fdqbNVuyaE9cVFfymuJwKGB1Puf/w4zhnazPVVK+ecB9rVjdHkGy5Kq ofuDjgblAoF8uO+Q0NR67UqHDMKQh/+YhcweREO6rBJatoR9tulV3qfPcv/ObTO73w60 Slmw== 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=4omqkgEsOa3d7dDrSHEj0fGIcb4u6Z71IZA7jxrxpXA=; b=tissYIWciQP56echN6wpUMbBj56835fdy7GteHdJETNDCfTA7EK20JLscsehwaB/dr cueEfn8oQaR/ALptAcM0j2IDzdO7sHGe3Z2JEqO6Mh81YTRn7RDx2BMHZwKmMV36admz Wf4jR35Sc2v0qpacCeAMi5hADeod2xObnuqb2IJP11ty4qNKxCQFVw1HI9E0jQwCch69 cKS9HS5yMF/4gLdURMNv7mFrmaoDVSg8iEZrNDROmtvUI6AwC+9yW9fJkPAaWkYn4qGF LmPU4bMU3X+t5damuKHUibatW4mf3iOykM2+QRPrLM+g77ThcDbtkNsm4AeWzt6we3Uv GvBA== X-Gm-Message-State: APjAAAVkLoHhOCD6cJnDJk51BdHa7Z07gysOJx1wvH3W5N3kN+FOU4nX dtRYyjd/Xsr9H385vD9YuDwW2oxpR4TGXLpnstY73w== X-Google-Smtp-Source: APXvYqwhR+z+UIZ4jgopakgOCjtQfQIV/2FB/mG9OzRVEd9xbqmcvQS251+v4BMhDWqCxWTMsQGJ/FkT4gtdl54+U4k= X-Received: by 2002:aca:ed52:: with SMTP id l79mr17312662oih.47.1570452039482; Mon, 07 Oct 2019 05:40:39 -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: Jann Horn Date: Mon, 7 Oct 2019 14:40:13 +0200 Message-ID: Subject: Re: [PATCH v5 04/12] S.A.R.A.: generic DFA for string matching To: Salvatore Mesoraca 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.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Oct 6, 2019 at 6:49 PM Salvatore Mesoraca wrote: > 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? While I think that it would be nicer not to have yet another implementation of the same thing, I don't feel strongly about it.