Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1394853pxk; Fri, 25 Sep 2020 13:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV7ZFB7lFMIgSa2BujOLbHppxunRSo1bacQYHDmXEpoe5tasEjIMBUm5teWNo673KpktT2 X-Received: by 2002:a17:906:49cd:: with SMTP id w13mr4438037ejv.151.1601066421590; Fri, 25 Sep 2020 13:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601066421; cv=none; d=google.com; s=arc-20160816; b=JHD0VES/PeKlKCOiZvVfntrvQZEZ2aZwChVWMx6RJOrHKJajw8gZ8ugemIz3R3mXxa gkaQR2UzWWP6rvcvNkeRPvmIhlqIX9gHxXKhXpTMS2AqYiSPy84UY4cctcSzriwMMBKs FJtMv3zab7e/eSQgrqE3fv/bvt8TB67O0uC2EaJxn0PDKgDFWMeOYrHVYkchWEYRkaJD PeDkn7EDiqTVBjd3ANYc965fJ3+N2ph9Nfvej/ymj6CmDRmSGWzLFVlmMRK23CO1B3p3 8DJLIrENdtCWYiASnmsbcaELBCysKwhZwNEdTsV9WRnOCxgF4fSoyjXeWrzHPc64idyK EgQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xalch59fDuEKl76YuuW9L6ISBYkH/TTx0Ff+RgikJxo=; b=mFOXdyEJJyrrbLjxlI55X17G4QOgGNra4BeyZUSHuO3OTVjmdW6hqXGJaNrYLhNT/q M2a5yONVqy5PJCBxcNYJnEoRSRi/M61KLg4qSn6OnB8nXMve+IzA5/KjNnMkY4P+v0l6 wBLsxBUkdJ+obkZuY7TtvrPAKdnaQt+Ir2+ButbZQMegdQ4opPHuXlqQQn7n4nItxHoc m3jjWv9EQ+mZm4BZGDfnCOKHaXssgdj+t58wlG/66EpF67MsQpltPqKYXxw3fCGqLj2i JsY0rgRcMTDtFsWCRq9p4rmeRAYL51tOLeeKzwx2Lat8kzwcKdB4Nzi8puadzq6jEILf ihSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hYaTNdNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si3137115ejw.596.2020.09.25.13.39.59; Fri, 25 Sep 2020 13:40:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hYaTNdNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbgIYUiu (ORCPT + 99 others); Fri, 25 Sep 2020 16:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728434AbgIYUif (ORCPT ); Fri, 25 Sep 2020 16:38:35 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE63BC0613B0 for ; Fri, 25 Sep 2020 13:30:59 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id l126so4332084pfd.5 for ; Fri, 25 Sep 2020 13:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xalch59fDuEKl76YuuW9L6ISBYkH/TTx0Ff+RgikJxo=; b=hYaTNdNHJvLXhzfO+DdQhP+Y6AQFVGOXPqty1ToYGSxhw3Gg9u0qORgOjwXhmBR7X+ 3RBtz3lDH0PW6AmY/qY7MMzKY6CsGoSJzyEB+byHzQg5n948zglNKeCBqL+BXCy6ISuz pLQE8ykuQBc1+Zol1mYktHi8NsaELoQn/dyBc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xalch59fDuEKl76YuuW9L6ISBYkH/TTx0Ff+RgikJxo=; b=gGnYnZjbnvWJMrKLofZQmLRb/eIGexCx7K8jbvWghfBjJfpxdLOnbuOKreD7AQO7gg qvQD3gdISWitjrlTZi0FfMbZ5ByUz5376qmQZvwagfmQGTVQCa4RCDj7MfTtVXsE6jVj DkO4Xodhis/l2NghvD23X6qOhigQGwW0L/ZCjgmaqNimvoveflPxziZc0ob9rl+uSIjT p+4bEG94SyEwE+1fp8Vc2vW8++6RovBHrBJDTGeVa4uhAhjHMLt51fdnNnSIFsafyvP0 oDttBE3PbFdEsTj6TZltnkLTCUtEfSzYUlXUqHj6976Y5w18ddLLNNC+tF2J/eFKpImR XwhA== X-Gm-Message-State: AOAM530OXZdVDsLZ8lTEhwTGgOY3bV6cWOg4M+Zmp5y5ADDwGuQ3e4SZ ZWXy6pBTsp3TSpMJ+PZKfW88w4bvS9tgQWAO X-Received: by 2002:a17:902:c252:b029:d2:4345:5c7 with SMTP id 18-20020a170902c252b02900d2434505c7mr1152244plg.4.1601065859302; Fri, 25 Sep 2020 13:30:59 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g1sm70849pjs.30.2020.09.25.13.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 13:30:58 -0700 (PDT) Date: Fri, 25 Sep 2020 13:30:57 -0700 From: Kees Cook To: Gabriel Krisman Bertazi Cc: Thomas Gleixner , luto@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, willy@infradead.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, kernel@collabora.com Subject: Re: [PATCH v6 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag Message-ID: <202009251327.587D111@keescook> References: <20200904203147.2908430-1-krisman@collabora.com> <20200904203147.2908430-2-krisman@collabora.com> <202009221243.6BC5635E@keescook> <874kno6yct.fsf@collabora.com> <202009231349.4A25EAF@keescook> <87o8luuvze.fsf@nanos.tec.linutronix.de> <87k0whsuh1.fsf@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k0whsuh1.fsf@collabora.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 12:15:54PM -0400, Gabriel Krisman Bertazi wrote: > Thomas Gleixner writes: > > > On Wed, Sep 23 2020 at 13:49, Kees Cook wrote: > >> On Wed, Sep 23, 2020 at 04:18:26PM -0400, Gabriel Krisman Bertazi wrote: > >>> Kees Cook writes: > >>> Yes, we can, and I'm happy to follow up with that as part of my TIF > >>> clean up work, but can we not block the current patchset to be merged > >>> waiting for that, as this already grew a lot from the original feature > >>> submission? > >> > >> In that case, I'd say just add the new TIF flag. The consolidation can > >> come later. > > > > No. This is exactly the wrong order. Cleanup and consolidation have > > precedence over features. I'm tired of 'we'll do that later' songs, > > simply because in the very end I'm going to be the idiot who mops up the > > resulting mess. > > > > No problem. I will follow up with a patchset consolidating those flags > into this syscall_intercept interface I proposed. I assume there is no > immediate concerns with the consolidation approach itself. I think the only issue is just finding a clean way to set/unset the flags safely/quickly (a lock seems too heavy to me). Should thread_info hold an entire u32 for all intercept flags (then the TIF_WORK tests is just a zero-test of the intercept u32 word)? Or should there be a TIF_INTERCEPT and a totally separate u32 (e.g. in task_struct) indicating which intercepts? (And if they're separate, how do we atomically set/unset) i.e.: atomic_start toggle a per-intercept bit set TIF_INTERCEPT = !!(intercept word) atomic_end -- Kees Cook