Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4244808ybp; Mon, 7 Oct 2019 05:41:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtkKZp27tLAilxXJvqNEHb7bVkNe1hvFrU/Q8h3LbtR2tsDHu/0Y6CtCqftCFoalitmS8i X-Received: by 2002:a17:906:1f12:: with SMTP id w18mr23636711ejj.224.1570452087503; Mon, 07 Oct 2019 05:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570452087; cv=none; d=google.com; s=arc-20160816; b=Q/1FwV837XUGwb/Z7csFDMqd1jjPgtNCAKLpAxEngfnTo57XnfR4PT4osyoalWD5gs fNvzNRF3cW38+VNm4sI2ylhyd1EI0TWa6c2NJ7k8M5N5cCkS3Fkgo75aLWE2co7wuZyv /URJ4GZ7WTAqiA6jM1C4vsTwxxDhHtVdIfgEhjRhfzdcub3tdlZ6FbX5oWW4oGd7oMAs 8ynU99mRjfY3BkfTVlzJ6QwdnQl7A7zd9aZpEMlmcVaHZwDtoVMp+VlWrH135Z5RVZhC KmYr4M5lgb8HP67jiHsFVtfxY34Xt+sBcRwZ+5fK91gcnJ97tzmiga0VQc76WZAPZEqS 2JdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4omqkgEsOa3d7dDrSHEj0fGIcb4u6Z71IZA7jxrxpXA=; b=MIIDURfDhdRskL5yn4vqsRFt0H7my7bIHaSzb1y2aNjBkvEkq8lnRodElbGODB+NgI EwkuJ+NToj55zjlpzGu4GzIFt0JBfKM9UxT21mh9TfEyPrPlkd9HsjLr2oeGGXs5gDVQ 05uESF2OviCGcOaoZd5uBWMIEg182dcZlmXlqWflXUz8l18gwtxliNN6CfdwPZV1wI3+ 1ZBeuBJ8C4qmjG2yl5ZXiqIRElDUeGomsRZMAq25S3HGSuDOq202YsQlx/Xm3PDzedqa hbEAtCdwvt4A0lPh1J+mnjsimMDgr7nZD7oJtCgmcSvz65pRuAIdUcP5fVP7uEm+/0VH Kzbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dDiR8orV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si7117175ejy.374.2019.10.07.05.41.03; Mon, 07 Oct 2019 05:41:27 -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=@google.com header.s=20161025 header.b=dDiR8orV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727734AbfJGMkl (ORCPT + 99 others); Mon, 7 Oct 2019 08:40:41 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:40651 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727490AbfJGMkk (ORCPT ); Mon, 7 Oct 2019 08:40:40 -0400 Received: by mail-oi1-f195.google.com with SMTP id k9so11477374oib.7 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=SwOOazgxvRZhepu7MlcFcBPlhn0ByXBugKRVi83VB+1zaBrmDeXUqVEj4qCFA8xPMU IWK3sIA1c4ZNd6XTtvQb10FqQJ3EjNioieyzrqszQj4kh4Y7KocxUdSdKvxI0ozdvE5l HI8XQDnnICYuAxqDjqDJoouyjsUfnnIAXdmpDgVhUSjVmWI1faJY/Dbs5stdzvqG5hIl 9BbAWaOoVJIArooEd/l+H9gO/joTdsMTxfG3e9aedW7t5SEO8X2o3MU7Uge3KX8Vbaet k0jppyQdLE+76xvcCyahHCJNzjrotf/T4wL/WuGAierL1lMqU2Mdggj3tkTDw/Z6nqNQ 8l5A== X-Gm-Message-State: APjAAAVO8z/YXlzXYaa9ZfO+NwpeVbH92ZUmRQixWzg3yJu4g8mLD9pI f+Gy1iF5gbyBQxy3zVuexabK5q9GXbRx0rrunmuEX8sprkQ= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.