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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7BCED6C2B8 for ; Tue, 19 Nov 2024 23:48:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 476426B0083; Tue, 19 Nov 2024 18:48:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 426136B0085; Tue, 19 Nov 2024 18:48:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C6F46B0088; Tue, 19 Nov 2024 18:48:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0CBDB6B0083 for ; Tue, 19 Nov 2024 18:48:24 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 827E6140620 for ; Tue, 19 Nov 2024 23:48:23 +0000 (UTC) X-FDA: 82804485162.11.56F1632 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf07.hostedemail.com (Postfix) with ESMTP id A174840007 for ; Tue, 19 Nov 2024 23:47:10 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dT1jmOc9; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf07.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.210.45 as permitted sender) smtp.mailfrom=jeffxu@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732060035; a=rsa-sha256; cv=none; b=jtti1fh0k+zAmqDx5FdtbZV0sSgOaSfAE2KTbrFFOfmDsoYiTrZrZRJZ26pRq3Hxuzg9j0 tCTHCU1Ic0qpCK7QnM3HEGPhNdpkuTDXtb5+T05Ik2XM5JeAlkYZBX4DNX79QnhDvyGG+8 X+DVGuW/VuyRTEXklzAAhsvgskj+pNo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dT1jmOc9; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf07.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.210.45 as permitted sender) smtp.mailfrom=jeffxu@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732060035; h=from:from:sender: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:dkim-signature; bh=fyNd50+LY35UktYX9M4sdhJ4n5XjqMzt2DSU5TuogyE=; b=pUe7QkOYZoPRpc/bmJxoBb2xj8smfu3DVgEvPtzQYBIsQRi7usJviS3caanhqvjyJzD4SK Cai7NzFMKH2OHDmVvskFI0auaY9tONtcUcNhfK1cZxkV0tg4hUeD+X/TKcd0UWM1fDev9z P7xPiwWVJi5v6w2nnpB7MTocJwy5g3Q= Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-7180b844515so163822a34.3 for ; Tue, 19 Nov 2024 15:48:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1732060100; x=1732664900; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fyNd50+LY35UktYX9M4sdhJ4n5XjqMzt2DSU5TuogyE=; b=dT1jmOc9/LNSuVkhQhNn/7AH6ekiNEQquNzClQVGG2OOR6vHOGihk0n+LNCMe3oVfC Uux+28NuD9iO7Czo9kIafjOXV1uGDmDHFQldhqXDTUn4Q3KexPetdyklfwzB56xO+oRU GODELxd/0VvvlonfkEmbIF2CZm7RYvMUStJtE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732060100; x=1732664900; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fyNd50+LY35UktYX9M4sdhJ4n5XjqMzt2DSU5TuogyE=; b=gfVCZQNyFZcHbKgwi789RirV/Lq3+jBwGy62sQq68ycuZ0Jnmfwh4/zCGiF4oXKF1g RnlCPfMCgSXbJlfEAtyFjIGPhqOi7dzXu7YXs8vWIkmNTABmpbKq1+FwHzmHIrCqlhut /z4pkLaT/2P1tMgdoOSjZtKxo7B/Iu7dA/eD08NywNjLGC/RaVsHMkPuD9XFmkhf14eo 2lniwNvdoxniagT/+uTi/oUPW2FYZquG7yCvXPW0cCL/ie/DV/2wHWlF8a6kGM1TBck+ UrUk7sCzDIuiOT3FqFpcqDzzPQlK56slfGB7/l+MZsN52YH/q6+taIIiz638/9dEYY9K Xhzg== X-Forwarded-Encrypted: i=1; AJvYcCVQGMEqwRgguFnnGGdCIPh/ZILlrqO0trwFMlySKxeVjLlKJqCt7wISYfUyYTVO99424E3xpesfDA==@kvack.org X-Gm-Message-State: AOJu0Ywlmz6uajTG7unGwBZ5e9XcK2GUAhx5/aiPmQri9GEkuZqrSkUC 1Rn3MtA/S1Ay37dQN1zVT9NcVuYY9bl0AClDK8H0QYyvcKdkJogLZuPZE7mmcrlSJ8vxfYGhpaI c0/a3k/kCmQKbwNgFv6/X9pg0JM+/tCngqJJo X-Gm-Gg: ASbGncsDK2dfOkVkycIJH4nD0jVfOqHlgXe6XnPbRtOHKzGOzZWQS9tJHRZbMLarKXA 2VYV5E1meQR7AXVucs4awcTYIohyIhbnRAbk6B629cTr7mZp6t6CFdhbBjQe9 X-Google-Smtp-Source: AGHT+IFg6zWKpsHxvtrmEK1BG7v+5gDlMgJkvn1TB15fPWVB8h6nditCM7xI0m8sK1IGFu/u7Ov2VHKL2bxU+XXJWJw= X-Received: by 2002:a05:6830:9c2:b0:717:fdb4:c1ff with SMTP id 46e09a7af769-71ab2f65f6emr182463a34.0.1732060100644; Tue, 19 Nov 2024 15:48:20 -0800 (PST) MIME-Version: 1.0 References: <20241113191602.3541870-1-jeffxu@google.com> <14600b0e-6d6f-4ee3-9230-3d1f7b807710@lucifer.local> In-Reply-To: <14600b0e-6d6f-4ee3-9230-3d1f7b807710@lucifer.local> From: Jeff Xu Date: Tue, 19 Nov 2024 15:48:09 -0800 Message-ID: Subject: Re: [PATCH v3 0/1] seal system mappings To: Lorenzo Stoakes Cc: akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, torvalds@linux-foundation.org, adhemerval.zanella@linaro.org, oleg@redhat.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, sroettger@google.com, ojeda@kernel.org, adobriyan@gmail.com, anna-maria@linutronix.de, mark.rutland@arm.com, linus.walleij@linaro.org, Jason@zx2c4.com, deller@gmx.de, rdunlap@infradead.org, davem@davemloft.net, hch@lst.de, peterx@redhat.com, hca@linux.ibm.com, f.fainelli@gmail.com, gerg@kernel.org, dave.hansen@linux.intel.com, mingo@kernel.org, ardb@kernel.org, Liam.Howlett@oracle.com, mhocko@suse.com, 42.hyeyoo@gmail.com, peterz@infradead.org, ardb@google.com, enh@google.com, rientjes@google.com, Michael Ellerman , Jorge Lucangeli Obes Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: A174840007 X-Rspamd-Server: rspam01 X-Stat-Signature: idftfobuuqdheqkk1nutbuzhksk47yef X-HE-Tag: 1732060030-262883 X-HE-Meta: U2FsdGVkX1/rSN7jmGFuGHtwFspr6cRoaecMG21KFEpjSYHLhbXYMVwxcDc0UrBToIQlpw9uS8iDsqkFoHCkJ96WeDSvXvl8jeG22KHr6lJKJO8xhA+2eQJI8pDQ+G7RgwdLPPGbmgrb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z6PW0gh8Mp5+bq/sj6SOz4E1kFiniPUfYFARfNXst59hTG3ILdYH++xdNGW0Oj/xTmSt3xyWvgawc9qfIWIwzVeqPghwudLuFCjrPKhPQbxfYOFls8IdYRoerZSlbQNgCyvUe1PWL2b0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Lorenzo On Wed, Nov 13, 2024 at 12:36=E2=80=AFPM Lorenzo Stoakes wrote: > > You left kernel test bots and review unanswered on v2, which makes it > difficult to know whether you actually addressed everything. > Thanks for reminding me, I got distracted previously. I responded to the test bots. > Please respond to all outstanding comments in the v2 thread so we know, > thanks, even if it is to say 'this is no longer an issue as v3 addresses'= . > All comments of v2 were addressed in V3. > On Wed, Nov 13, 2024 at 07:16:01PM +0000, jeffxu@chromium.org wrote: > > From: Jeff Xu > > > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > > > Those mappings are readonly or executable only, sealing can protect > > them from ever changing or unmapped during the life time of the process= . > > For complete descriptions of memory sealing, please see mseal.rst [1]. > > > > System mappings such as vdso, vvar, and sigpage (for arm) are > > generated by the kernel during program initialization, and are > > sealed after creation. > > > > Unlike the aforementioned mappings, the uprobe mapping is not > > established during program startup. However, its lifetime is the same > > as the process's lifetime [1]. It is sealed from creation. > > > > The vdso, vvar, sigpage, and uprobe mappings all invoke the > > _install_special_mapping() function. As no other mappings utilize this > > function, it is logical to incorporate sealing logic within > > _install_special_mapping(). This approach avoids the necessity of > > modifying code across various architecture-specific implementations. > > Some arches unmap VDSO's which mseal prevents, so are those broken now? D= id > you test this? > Do you happen to know which arch might unmap vdso ? The information I collected so far is only CHECKPOINT_RESTORE would remap/unmap vdso. And if CHECKPOINT_RESTORE is enabled, Kconfig will prevent this from being enabled. > > > > The vsyscall mapping, which has its own initialization function, is > > sealed in the XONLY case, it seems to be the most common and secure > > case of using vsyscall. > > > > It is important to note that the CHECKPOINT_RESTORE feature (CRIU) may > > alter the mapping of vdso, vvar, and sigpage during restore > > operations. Consequently, this feature cannot be universally enabled > > across all systems. To address this, a kernel configuration option has > > been introduced to enable or disable this functionality. > > > > [1] Documentation/userspace-api/mseal.rst > > [2] https://lore.kernel.org/all/CABi2SkU9BRUnqf70-nksuMCQ+yyiWjo3fM4XkR= kL-NrCZxYAyg@mail.gmail.com/ > > I don't see any mention to testing, and this affects multiple different > architectures. > > Please describe what testing you performed and on what architectures. > The tests are done in ChromeOS and Android on ARM and INTEL. > I suggest we allow this only for architectures you have explicitly tested= , > especially as this is 'hidden' from arch maintainers who might find this > change surprising. > I thought the current approach aligns with Linus's suggestion of unifying vdso/vvar code [1]. I honestly think this is not architecture dependent, i.e. this doesn't require any specific CPU feature. I could add ARCH_HAS_SEAL_SYSTEM_MAPPINGS in KCONFIG and enable this for x86_64 and arm64 for now, this would allow other architecture maintainers to have opportunities to test this . [1] https://lore.kernel.org/all/CAHk-=3DwgTXVMBRuya5J0peujSrtunehRtzk=3DWVr= m6njPhHrpTJw@mail.gmail.com/ Thanks for reviewing. -Jeff