Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4360216pxv; Tue, 27 Jul 2021 05:40:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvXbh8YOL/xc3Wb8TO9UyR31VvREKuopWknENRI3JQGcgo7nd+elWSk25s1zyhX7WoGRWi X-Received: by 2002:a17:907:7e89:: with SMTP id qb9mr8801715ejc.333.1627389606682; Tue, 27 Jul 2021 05:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627389606; cv=none; d=google.com; s=arc-20160816; b=Qn4KZaRATiuSzMGvBNw8lppOzZ9SatW6zicWCglTNg3Ax/6kRVa+dVNFwS60Lv/LZn jkv6UmJdIXVHUaGMV/yzVzGQDsZJnluXP//vA8E4xVKnlGb4uMTCArvk2eRRSdeHz8Pr iLVnrdlxFdvHA7XQkNFFRTt8ujn+bHFqzf+OVho6NBYfY9mKQk3HWaacYu2ve+NEbjQX PyVX9DtDrzZA496/0SfmZ39oiiKkIETA2x1CsrHEoy7dGfY5qK5uWiUFGGxN1Cb7fshC 7PZlYlsN06hTd9iAow015s4xxSDhfvgwoqJGD81SPf45Px4JniCn0ydTsBNd4bFIgZJh gDBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=IZDouoyOqLsKp2iTq9JOWK7JiKU0dCWcs56CWcoTOuA=; b=zf7tOmLXj8020KTEjOLaZ4ijvlcoHksN9RQkteC1sOa16ibgwgFfSOwm2YIS30/LeA hfTt+6rj8elkQo4yriJ0BsszA2/Os+crZOjW2nCbVd+IGKLgCQrS33+4zHAUwnnAO9Y7 gHwTrfsmi4c5G9rl3KeEXiK1O3tPWibKKRWGR41kW2B0cHQR3cHD68BVz58nqCpgzv8m 7MOoXpcIaqqcD5d/t88wXYvijJ2tYQDRnhIW2txYnzrSK+q9/p9XGNsxxgepNIKUr7WS AxLuhoCjouoqIWQ7AkH2h4kWF9fUDOnNmGx3yjvyaBV0vLZ1ZzEl9GTPCVXpDC6T6u/B Drtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PvdBunLK; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h18si2601117eds.154.2021.07.27.05.39.42; Tue, 27 Jul 2021 05:40:06 -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=@redhat.com header.s=mimecast20190719 header.b=PvdBunLK; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbhG0MiU (ORCPT + 99 others); Tue, 27 Jul 2021 08:38:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46149 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231931AbhG0MiT (ORCPT ); Tue, 27 Jul 2021 08:38:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627389499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IZDouoyOqLsKp2iTq9JOWK7JiKU0dCWcs56CWcoTOuA=; b=PvdBunLKj1mrbWRSmJsXd10DfoqMG42vYAn1PBQmNy22pfOkoh6Ip1InB4znMWxnYEZG7Y bLpx33xa00idgjJR/ddPq+LXD9XL0g2eCs4ZQzEjvbnPxRq0KlScYvtAsnw59d7KLsf6Hx VziBWraUID41l1XihS3b6nvayEuB3cY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-FapNnTiPNvud_klWay_o4A-1; Tue, 27 Jul 2021 08:38:17 -0400 X-MC-Unique: FapNnTiPNvud_klWay_o4A-1 Received: by mail-wr1-f70.google.com with SMTP id o11-20020a5d474b0000b02901533f8ed22cso4488574wrs.22 for ; Tue, 27 Jul 2021 05:38:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=IZDouoyOqLsKp2iTq9JOWK7JiKU0dCWcs56CWcoTOuA=; b=A+eo732o+lt+y1LhLlDDhtVRFMFIeD8k78776K9FMOOFPyBnsSszeZPNsmSpowlx4x vb+gv1vRFRfR7QYJxUKZOx44qxCTEyiya8+tj/N8Hwqs28yQRV+aPZo/1O+yahL4Nj9y UHmNKAGhLM81Fg3i3vkCXgiE3Gzh2Aiet0U9mYAZcKsZuVjbCh0G/X36RtUd6muw+Z1I MG/FUWW+rpOu80cnc3V3lArexl0rLtSwz4MGMQALmi/K/LZa0BE1dpVlF3jr/PBocFh3 z6NFkJCqqdmICfOVL5HcdPFDFq/qFLPZYNVeX1C6gJGxyaxNtcAlA/kAZ7jY4ZZ3C1c2 xSGA== X-Gm-Message-State: AOAM530muAsbIuUMSpRt+P5dP5NwgnqGcWDZ+kgDG4a4xJokhQnJ3qGm 3K0DPftS80jzP0Ju0tKAKsbvVW2PPhlSvFTR7rN/KAT8lk9hg4MJLxKurnPkHY3kc8/4J/3d8ad 8EPLTj5UBnLgqOwXDqAOfh0zA X-Received: by 2002:a05:600c:3587:: with SMTP id p7mr3887632wmq.27.1627389496616; Tue, 27 Jul 2021 05:38:16 -0700 (PDT) X-Received: by 2002:a05:600c:3587:: with SMTP id p7mr3887614wmq.27.1627389496429; Tue, 27 Jul 2021 05:38:16 -0700 (PDT) Received: from [192.168.1.136] ([79.116.5.179]) by smtp.gmail.com with ESMTPSA id w9sm2939077wmc.19.2021.07.27.05.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 05:38:16 -0700 (PDT) Message-ID: Subject: Re: [patch 1/4] add basic task isolation prctl interface From: nsaenzju@redhat.com To: Marcelo Tosatti Cc: linux-kernel@vger.kernel.org, Nitesh Lal , Frederic Weisbecker , Christoph Lameter , Juri Lelli , Peter Zijlstra , Alex Belits , Peter Xu Date: Tue, 27 Jul 2021 14:38:15 +0200 In-Reply-To: <20210727110050.GA502360@fuller.cnet> References: <20210727103803.464432924@fuller.cnet> <20210727104119.551607458@fuller.cnet> <7b2d6bf91d30c007e19a7d2cbddcb2460e72d163.camel@redhat.com> <20210727110050.GA502360@fuller.cnet> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.3 (3.40.3-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marcelo, On Tue, 2021-07-27 at 08:00 -0300, Marcelo Tosatti wrote: > On Tue, Jul 27, 2021 at 12:48:33PM +0200, nsaenzju@redhat.com wrote: > > On Tue, 2021-07-27 at 07:38 -0300, Marcelo Tosatti wrote: > > > +Isolation mode (PR_ISOL_MODE): > > > +------------------------------ > > > + > > > +- PR_ISOL_MODE_NONE (arg4): no per-task isolation (default mode). > > > + PR_ISOL_EXIT sets mode to PR_ISOL_MODE_NONE. > > > + > > > +- PR_ISOL_MODE_NORMAL (arg4): applications can perform system calls normally, > > > + and in case of interruption events, the notifications can be collected > > > + by BPF programs. > > > + In this mode, if system calls are performed, deferred actions initiated > > > + by the system call will be executed before return to userspace. > > > + > > > +Other modes, which for example send signals upon interruptions events, > > > +can be implemented. > > > > Shouldn't this be a set of flags that enable specific isolation features? > > Something the likes of 'PR_ISOL_QUIESCE_ON_EXIT'. Modes seem more restrictive > > and too much of a commitment. If we merge MODE_NORMAL as is, we won't be able > > to tweak/extend its behaviour in the future. > > Hi Nicolas, > > Well, its assuming PR_ISOL_MODE_NORMAL means "enable all isolation > features on return to userspace". > > Later on, if desired, can add extend interface as follows (using > Christoph's idea to not perform automatic quiesce on return to > userspace, but expose which parts need quiescing > so userspace can do it on its own, as an example): > > #define PR_ISOL_QUIESCE_ON_EXIT (1<<0) > #define PR_ISOL_VSYSCALL_PAGE (1<<1) > ... > > unsigned long bitmap = PR_ISOL_VSYSCALL_PAGE; > > /* allow system calls */ > prctl(PR_ISOL_SET, PR_ISOL_MODE, PR_ISOL_MODE_NORMAL, 0, 0, 0); > > /* > * disable quiescing on exit, enable reporting through > * vsyscall page > */ > prctl(PR_ISOL_SET, PR_ISOL_FEATURES, &bitmap, 0, 0); > /* > * configure vsyscall page > */ > prctl(PR_ISOL_VSYSCALLS, params, ...); > > So unless i am missing something, it is possible to tweak/extend the > interface. No? OK, sorry if I'm being thick, but what is the benefit of having a distincnt PR_ISOL_MODE instead expressing everything as PR_ISOL_FEATURES. PR_ISOL_MODE_NONE == Empty PR_ISOL_FEATURES bitmap PR_ISOL_MODE_NORMAL == Bitmap of commonly used PR_ISOL_FEATURES (we could introduce a define) PR_ISOL_MODE_NORMAL+PR_ISOL_VSYSCALLS == Custom bitmap Other than that, my rationale is that if you extend PR_ISOL_MODE_NORMAL's behaviour as new features are merged, wouldn't you be potentially breaking userspace (i.e. older applications might not like the new default)? -- Nicolás Sáenz