Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1279882rdb; Fri, 16 Feb 2024 10:25:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVR+AaxSH6y85F9YYp+be7ZeZeaNGSM8Z0KfpVB0Bettcj2skHjDf+6zLvzhGZhya9TYYkVUBdAcxlpLjNPfSsuGc4/9G63YId43X/xtg== X-Google-Smtp-Source: AGHT+IG1Lf227k6Yql5JOpUwx99ula1ZKE1T6tpjldTtl7edvOaz6L+iwBxJz4v3QJdEPQWZFXR9 X-Received: by 2002:a17:902:c949:b0:1d8:cfc9:a323 with SMTP id i9-20020a170902c94900b001d8cfc9a323mr7669055pla.34.1708107944063; Fri, 16 Feb 2024 10:25:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708107944; cv=pass; d=google.com; s=arc-20160816; b=NiYbGIKp5IiknLEv7jhDruCeno3xV/TrcJpQKrFnZ8uvydjnWp35lN7jxcbaaOVN6l Uy5UXTPQrW8kZZH2JZzx2SKEJsfgIhLGYDygV0jAfoXp+n9n3H/jucFXzkOO6mkw12tS Lk1Gh70pyZYYjMfqlJrRLhUgkIm6nGgAkySDXL+LdIpNx7onEgHlN+0pb6QEKPsHMq2G IJNR1/CVYLluiTTrjEoQBPAmE13bTjYznwiwEarDFgyeCRkqoU9mEz1uz9UAznbqFcOZ 1lHxejo4GuiFp8tFSynMGLb5HB0rWENndL+FLSYe3uTB4U0gLZYuhqW64DGLyYFPQC27 osbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Jlix/BT2PLLtM1BnpkXu5I67IZd3XLrrMtiMKTImwHc=; fh=fLoBK7V+6bL0MQWSBYoeibKsF8xGskO3Svz2W4nMAfY=; b=ipETEsFK/wVH977gYdvNB7WMcWIAN4j8Bfe1uKqeLP0kxMKO0Wuf6cxeM5DsQ20owj wBCCWUXJTmpiPGxoQDLjNkHQRvOAi4ABYTEp5sC2xquEFr97SQqcJD2wZt6TPUZlMyrk 3ddxolPaIPQy1XNVrtTSo0HC7oQQRcOCWyJpx7nGrt8sXyq7eGn1fhSkkyhTmiuvPf4O WvKnbAZvygzLwYaA4o06PZo8hbVfP9u/tnjLeFU6kNkeFbsxVrcTFYBM9PMg0UVh/xsz +CCfuVBq5ex5pVPqkynDv8PrKk/3ey2zNfdb6F9XqwaP5403fBM/NwSyuWJIZnRIju2+ lYdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-69147-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69147-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lq8-20020a170903144800b001d629b6e88esi227257plb.287.2024.02.16.10.25.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:25:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69147-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-69147-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69147-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BCAB0284EF9 for ; Fri, 16 Feb 2024 18:25:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 016C81350E5; Fri, 16 Feb 2024 18:25:36 +0000 (UTC) Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E25C131722; Fri, 16 Feb 2024 18:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708107935; cv=none; b=LMHQyli+UlLVheAbiqrA+hceCd9s+i+tSbzsaSrXKrXBYrMi5QwckZMylOET8SzGnZh40X7g6S+x12Bul0+HDRG3PX/vam4tlLvALNldngTbKajf+59EelAwy1biBBw/P/oXCC/Sd1CVYBRxSOjKsnceNVLX5g8JF4j0Q0PVG5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708107935; c=relaxed/simple; bh=kIkgK71iz07GCR0FVYa+wZExsN8ozSUAm/msq7WJ/Pw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=u/uFCBe23pCBXvrz2917A21CPxSxhrliBdCS3h6dLRfkcPOZZHhLBaD5Kb7a939VwbPoGR/x4e/O+qtD+bjr9zezflBBDu1M3yGbpmAfcDnHVQEeYDDD5gOVJyVd5HvF9zO79xkRseTT6AJJyNowZgWQdcZ/VloC4H2rJgxaxvo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=14.137.139.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.18.186.51]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4Tc0Mj5r3jz9ybwR; Sat, 17 Feb 2024 02:10:09 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.47]) by mail.maildlp.com (Postfix) with ESMTP id 877641405A1; Sat, 17 Feb 2024 02:25:20 +0800 (CST) Received: from [10.45.150.70] (unknown [10.45.150.70]) by APP1 (Coremail) with SMTP id LxC2BwC3rhd6qM9ldImiAg--.12363S2; Fri, 16 Feb 2024 19:25:19 +0100 (CET) Message-ID: <33a1fae4-d713-4e93-89ff-ff9f377e8391@huaweicloud.com> Date: Fri, 16 Feb 2024 19:24:50 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 0/8] PGP key parser using SandBox Mode To: Jonathan Corbet , =?UTF-8?B?UGV0ciBUZXNhxZnDrWs=?= , Dave Hansen Cc: Petr Tesarik , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Andy Lutomirski , Oleg Nesterov , Peter Zijlstra , Xin Li , Arnd Bergmann , Andrew Morton , Rick Edgecombe , Kees Cook , "Masami Hiramatsu (Google)" , Pengfei Xu , Josh Poimboeuf , Ze Gao , "Kirill A. Shutemov" , Kai Huang , David Woodhouse , Brian Gerst , Jason Gunthorpe , Joerg Roedel , "Mike Rapoport (IBM)" , Tina Zhang , Jacob Pan , "open list:DOCUMENTATION" , open list , David Howells , Petr Tesarik , jannh@google.com, linux-security-module@vger.kernel.org References: <20240216152435.1575-1-petrtesarik@huaweicloud.com> <20240216170805.0d0decd5@meshulam.tesarici.cz> <87y1bktjdk.fsf@meer.lwn.net> Content-Language: en-US From: Roberto Sassu In-Reply-To: <87y1bktjdk.fsf@meer.lwn.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:LxC2BwC3rhd6qM9ldImiAg--.12363S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uF4UGw18Kw47WrykZr4UXFb_yoW8tFyrpF 4YvFZ0yF4DG3Z2ywn7ur1xua48ZwnxXay3ArnFg3yrAwn8ur18A3ySgr4avasrtrsa93y2 vryYqFyjka9rA3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv014x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26rWY6r4UJwCI c40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267 AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq3wCI42IY6I8E87Iv67AKxVWU JVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7VUb J73DUUUUU== X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQAPBF1jj5puTQAAsC On 2/16/2024 6:21 PM, Jonathan Corbet wrote: > Petr Tesařík writes: > >> On Fri, 16 Feb 2024 07:38:30 -0800 >> Dave Hansen wrote: >>> I'm confused by this. The kernel doesn't (appear to) have a PGP parser >>> today. So are you saying that it *should* have one and it's only >>> feasible if its confined in a sandbox? >> >> I'm sorry if this is confusing. Yes, your understanding is correct. >> This patch series demonstrates that SBM (even in the initial version >> that was submitted) allows to write a PGP parser which can survive >> memory safety bugs withoug compromising the rest of the kernel. > > So I have a different question: some years ago we added the "usermode > blob" feature for just this kind of use case - parsing firewall rules at > the time. It has never been used for that, but it's still there in > kernel/usermode_driver.c. Is there a reason why this existing > functionality can't be used for tasks like PGP parsing as well? Yes, it was an option I explored last year (briefly talked about it as a BoF at LSS NA 2023). You are right, there is such feature that seemed to fit well. User space blob embedded in a kernel module, so signed. User space process connected only to the kernel through a pipe. I even went ahead, and created a framework: https://lore.kernel.org/linux-kernel/20230317145240.363908-1-roberto.sassu@huaweicloud.com/ so that anyone can implement similar use cases. The further step is: how can I ensure that the process launched by the kernel is not attacked by root (which I assumed to be less powerful than the kernel in a locked-down system). I handled this in both directions: - The process launched by the kernel is under a seccomp strict profile, and can only read/write through the pipe created by the kernel (and call few other system calls, such as exit()). Otherwise it is killed. Cannot create any new communication channel. - I created an LSM that denies any attempt to ptrace/signal to the process launched by the kernel. Jann Horn also suggested to make the process non-swappable. However, despite these attempts, security people don't feel confident on offloading a kernel workload outside the kernel. This is why this work started. Roberto