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 63DB9C2BD09 for ; Tue, 9 Jul 2024 08:52:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B71356B009D; Tue, 9 Jul 2024 04:52:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B21966B00A0; Tue, 9 Jul 2024 04:52:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E9746B00A1; Tue, 9 Jul 2024 04:52:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8160A6B009D for ; Tue, 9 Jul 2024 04:52:38 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id ED5E2417AC for ; Tue, 9 Jul 2024 08:52:37 +0000 (UTC) X-FDA: 82319598354.11.88027FB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 26F691C001D for ; Tue, 9 Jul 2024 08:52:36 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HMFIk3ts; spf=pass (imf18.hostedemail.com: domain of fweimer@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=fweimer@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720515126; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aKrbvYatQQa9iqD/RLLmut5wz3BIvGbGeZI4a400mkw=; b=ZwlaALRxC/LGqDwCo2S/4nStDoost/VUhnYvTQzAIY2PA8zNBZIrGqKDN1ElRoKQfxnPN3 wQxiNB4QPl9QQdk80r3vlO76IUd0Aysuex7OT1S2+mmE2pTMuOip8BFDD5GPfs0pC4e9US kFy+hAOrs+YpAeiISFxPcIyO2ke3tio= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720515126; a=rsa-sha256; cv=none; b=tBpf/c7DdwFhMzU9NlSJzQfYw2I3jl2gaIwq9lUKuSlGlvUfhSCtOwrwEGZ+41sQdlx64b udjLQOVyopAQR53/55lXwh29qRXn6pm3bJvl4744+CPkSLjcEQELOSGYPEki2t8a6e677o B//rZrlk5fuOV69G+f8lFcYD9AWil7o= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HMFIk3ts; spf=pass (imf18.hostedemail.com: domain of fweimer@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=fweimer@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720515155; 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: in-reply-to:in-reply-to:references:references; bh=aKrbvYatQQa9iqD/RLLmut5wz3BIvGbGeZI4a400mkw=; b=HMFIk3tsdNgd0G/W3920YvH7HcQntzsRvCWHq8OMy0ZpSDltMfo732lvkKTBa0kWYYlPMf SCt/K4LSNVwhUVU3J8qUMbF54XuW8MeJFuXhx3BbBMd9yGWEoqLCbeRkrOxq0+1hf0o901 7HngYHfeIUSIFiImVeIxH1LTDeFA/KE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-494-95z-6JRaPpWfMZk9MN0rrw-1; Tue, 09 Jul 2024 04:52:30 -0400 X-MC-Unique: 95z-6JRaPpWfMZk9MN0rrw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A13F31958B3D; Tue, 9 Jul 2024 08:52:25 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.64]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DDBC43000181; Tue, 9 Jul 2024 08:52:15 +0000 (UTC) From: Florian Weimer To: Szabolcs Nagy Cc: Catalin Marinas , Joey Gouly , dave.hansen@linux.intel.com, linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, christophe.leroy@csgroup.eu, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 17/29] arm64: implement PKEYS support In-Reply-To: (Szabolcs Nagy's message of "Tue, 9 Jul 2024 09:32:21 +0100") References: <20240503130147.1154804-1-joey.gouly@arm.com> <20240503130147.1154804-18-joey.gouly@arm.com> <20240531152138.GA1805682@e124191.cambridge.arm.com> <87a5jj4rhw.fsf@oldenburg.str.redhat.com> Date: Tue, 09 Jul 2024 10:52:12 +0200 Message-ID: <87ikxf0wxv.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: 26F691C001D X-Stat-Signature: ycqzxaufzftwcgnexheu7es9awsyxb7s X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720515155-282981 X-HE-Meta: U2FsdGVkX1/pGWnTLAdfKwKs6blBS8YraBKXb2DET2UffG768GLbhvPEpVhQ0URoSeVHUqXSj/Wz2JoAg25Fivcke0NTv72FLQISoj+atqdOK4LN+riOas8s1jB59AWh5tO+zHb8ursLwouqMXnr+ylhslAWsxUKDkNg24dqRW/QZ4tC82/dlojRjg7PrCnVekb/11aHL7HCekLCMrtJjpK+AzsIBtUUNPnQoDBu0f151Gtuq/Dvc4RWT4Rm9MBbTPuHEfQ7pGt3TntHhw7f8zK9WSM8B9LmV0pJ24Oli8UKa0uGByihrT8r0UAgSxlVQnfuQrQ7JjNivHKznspKV3GvaiVxlJMrQuNezomyC8a0Ngdh3JCogZnn6tNr6DjramCfEtGGIAsZDt+BoPIE134asV064lx8jauSXjwOXhZNmP31u1YP10CU9M2bpFb19cE8aichKOif9nF+5SsZB0rmHIeDONjSqD9nothctQJHShHy141lnjy5Hmvh3P6IqEXQekhbDT/V15aeHur9Y+XbHiPTsegXmO+8LKJSQTcJF5R6asWCc8AZ9j/nABdyy8n7LwcdHRVzVNAcPMLeaL++65imbaWpEoim1+Hl+kNUT061EeJtJv1+nJUn/GDjkVFaNEJsE+nULrHSQjembBW3gySoYqqM3n8YATniFEm4px75vcuZ8fQHFw+2S7gnV8S9tS+tJ2037KtzXeJa7edU1c262Kqi8dAJhipscv18aC7q5ZPjq89IYHEs32vZLpGTIrGviTQFYYKTwKVgSHxcf+rOYOs37gLwTTNmLlU/CgfW1pr6mp47hg8kY56wk/UAxTccf+dyLF7SnJbWN+SspNpKS7nqATUGZORLkyXCcaR7KOenmhPhDcXGYvDhbINvgRCCgzvSuHFPREFDqwnRv+T7vM4BjyMAORUhUdXSzII1MwB+djQ1EhXgnEZAxj0gK6f+lLCFC30LQj5 /JpBZ2Ng 3zucsMqVP6V7HMPfYoKH549jgUV/XbxQCuJRu1oGL9xelNJOTofA3kftmS0+LXwTkPndua8IwfOj2EVbDpGdk/9HxIMNzsSzK4t44TKAzXVASZFa70BO/HWhOVp+0nh1oAmRwHvNaLQ0lqrlY/N+bD2+FV2oYW7z4hbqSoycvVJEWMzGjsg4Xb1ozloXsLbx69yIMUwnUBidkBDY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: * Szabolcs Nagy: >> However, does it matter much? That's only for the initial setup, the >> user can then change the permissions directly via the sysreg. So maybe >> we don't need all those combinations upfront. A PKEY_DISABLE_EXECUTE >> together with the full PKEY_DISABLE_ACCESS would probably suffice. > > this is ok. > > a bit awkward in userspace when the register is directly > set to e.g write-only and pkey_get has to return something, > but we can handle settings outside of valid PKEY_* macros > as unspec, users who want that would use their own register > set/get code. > > i would have designed the permission to use either existing > PROT_* flags or say that it is architectural and written to > the register directly and let the libc wrapper deal with > portable api, i guess it's too late now. We can still define a portable API if we get a few more PKEY_* bits. The last attempt stalled because the kernel does not really need them, it would be for userspace benefit only. For performance-critical code, pkey_get/pkey_set are already too slow, so adding a bit more bit twiddling to it wouldn't be a proble, I think. Applications that want to change protection key bits around a very short code sequence will have to write the architecture-specific register. > (the signal handling behaviour should have a control and it > is possible to fix e.g. via pkey_alloc flags, but that may > not be the best solution and this can be done later.) For glibc, the POWER behavior is much more useful. Thanks, Florian