Message ID | 20240418012835.3360429-3-yosryahmed@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 A4EFFC4345F for <linux-mm@archiver.kernel.org>; Thu, 18 Apr 2024 01:28:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C6AC6B0085; Wed, 17 Apr 2024 21:28:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 253516B0088; Wed, 17 Apr 2024 21:28:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02BC66B0087; Wed, 17 Apr 2024 21:28:44 -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 D7A306B0083 for <linux-mm@kvack.org>; Wed, 17 Apr 2024 21:28:44 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 86D4D4107A for <linux-mm@kvack.org>; Thu, 18 Apr 2024 01:28:44 +0000 (UTC) X-FDA: 82020918168.29.57AFE56 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf27.hostedemail.com (Postfix) with ESMTP id CE1CC40011 for <linux-mm@kvack.org>; Thu, 18 Apr 2024 01:28:42 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Zigxbb/W"; spf=pass (imf27.hostedemail.com: domain of 3SXcgZgoKCPAqgkjqSZeWVYggYdW.Ugedafmp-eecnSUc.gjY@flex--yosryahmed.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3SXcgZgoKCPAqgkjqSZeWVYggYdW.Ugedafmp-eecnSUc.gjY@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713403722; a=rsa-sha256; cv=none; b=sUNrp2N7sLX2N8y04tmbQkTEBHDaHvbIcso1bOt1WcPMw7rLhOSH97lFOmchIz8UVYg2QV r1bSuDAu9UkqCDF2QPtXif0qpsTYINCGxH5U/WKsCzGQ4XOtjFjb8QQhMC0mWTh62l1Lgb OVj53mFYk2i454VEM1nw3eT0ZXfmw4A= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Zigxbb/W"; spf=pass (imf27.hostedemail.com: domain of 3SXcgZgoKCPAqgkjqSZeWVYggYdW.Ugedafmp-eecnSUc.gjY@flex--yosryahmed.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3SXcgZgoKCPAqgkjqSZeWVYggYdW.Ugedafmp-eecnSUc.gjY@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713403722; 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=1IocH4dK3cU7wr7fT/1eXbTtilS5jPEYt4JFcTK0tuc=; b=yjOGKXZ2bPZjObAgurRRuy9MJOi30P7yoiSEMqBGX2LzUKn75IUhuvOronzttwI2PxVi8/ ZzbGwt7xANpLlv4jcOuuMcJ4sZ3iB86CAWNzlchaFYi4Mq1fmZMS9dUVA3mY52+qbUoSBk 1gzm4lkaoBTGBtL9vCFl5S+JI6zu7ho= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc58cddb50so791784276.0 for <linux-mm@kvack.org>; Wed, 17 Apr 2024 18:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713403722; x=1714008522; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=1IocH4dK3cU7wr7fT/1eXbTtilS5jPEYt4JFcTK0tuc=; b=Zigxbb/W3398FPOPVWdMa9IBTbb3Zp4PE8yviklaM/CVLNxkxASy1zbtImsq9sBNF2 niWmlR5lfEUTT+XvrNbuJP5IRASdofEsjSEqmcIU5j11DeQfpU7WnurKVF7dQvSSHPqw 73lLhSpOs8LUDVq+NpEwiNwNgnG/wiTUQNsH3wtS2rFyUAio9Ah5P6YMtOZBfo8Gavd/ nXZ1otRjVOTjRHXpNDuBv7iYkXcBUpnRyadq+r0MdtIeZYBato8Z1AiOlfNk04/+1DHp ZL7in4ZrQylF6kONEdLspO4w9P5hJRORgMOSQe1zbj6S9eSoJHo0/FZ7uK8UOevSnsJU zknw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713403722; x=1714008522; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1IocH4dK3cU7wr7fT/1eXbTtilS5jPEYt4JFcTK0tuc=; b=u2kBat8AgpsVAMlqUKMOjJGYlYg1PyGUO4enOEBz0RXKesuJUHD7psLu1+tbR96C6k CbzqjKqisoE6Z/yAfnCP7UBgxwt1SB49ppqnXhbSbgx7RrOGihhKIRLhKwfF2Ov8nF7J CWV0sC7Twtb9LVlu3RpJ8BlSAJRxLRNOlHn0h5ZtN4aKFy76RBX3yaRATGI4iJ1WtF0V nx7+pudxfzrJxTvgG76QEq0PNkIzYV7x2TbbHUXZ+ua8noQviL22wWcSHxp1u0t/QA4n EErcxZA40eKCgTZBXVuLZ0NG577gtiNZ0f2YEEujzaWgWldDxwTZvcDSfv2chCdjlF5d QXPg== X-Forwarded-Encrypted: i=1; AJvYcCVgYp3Vf55FhltCo3gqMjJ8eEqS3GNcseoDAbegY55aN+enf7oBQnA78QA6Dsjffl6As/i/u75DMpDR+4lIhYwFSkI= X-Gm-Message-State: AOJu0YwlcDX5F27Q3VL5YdyIzZspBqDd9CzL3KSzI1TVU+LQ0d+j6opw vV4L9rOOa03cFIR+aZeUlfJcqNIJXy/Anv1kSOS2OGxWDKhIwysHB9gvGLGM3bkwJ9LvTb0jW37 F0YQ7bKvjqqjQ/DjAkw== X-Google-Smtp-Source: AGHT+IHSfSOAwqPT5+RVg+FkCynH2REwXQqip28l12UA6TCmdrVfJ3C58BqU4WK+J+oNidSiUh15Dp0ZWHsFTsRk X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:704:b0:dc6:e1ed:bd1a with SMTP id k4-20020a056902070400b00dc6e1edbd1amr320570ybt.2.1713403721892; Wed, 17 Apr 2024 18:28:41 -0700 (PDT) Date: Thu, 18 Apr 2024 01:28:35 +0000 In-Reply-To: <20240418012835.3360429-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20240418012835.3360429-1-yosryahmed@google.com> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240418012835.3360429-3-yosryahmed@google.com> Subject: [PATCH tip:x86/mm v3 3/3] x86/mm: Cleanup prctl_enable_tagged_addr() nr_bits error checking From: Yosry Ahmed <yosryahmed@google.com> To: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Rick Edgecombe <rick.p.edgecombe@intel.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed <yosryahmed@google.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CE1CC40011 X-Stat-Signature: k4zkdqgwwwgghdsgmg55n3ixypuafpba X-Rspam-User: X-HE-Tag: 1713403722-229969 X-HE-Meta: U2FsdGVkX18siPtLmSl37cs5apkbPuNAaD+8Y4vw9mWS8eISI8XNS8ydMhOBxfVhOGdN6NfaAXz5j+YXVYFyJo1G+W0JJBH1xnrG9iKXX9qfGeK7mE7ldqQgdEt5atedGqKMKWLGZtQC0YVvjmMBwBMnJ2HOWU46iqaCI9vHpRPZV9vCa2KP9+y4cqQfvJDG/vrqyWfp7CHBf4Qoj/LVOIAqYUbf9FbStzSPoR1Km9bv50JJzIX+zdW/5LnSn1HQHgimpINWkauMCj0Tc/FvjPD7AB4T2e/00szETGPtXxqe8z6kx7U6KB81koAo/GiIVdG+iR3Mdk9c4dXt05KPAuXFU+vHQgf3ms0FKGm9zxlW6OEVZZYyCuIMrGc5OUX5MgzzkiAMimfQmLsmkdY8eKiTxrD3+1oCPoX8vqfJPVybj1att+GDh3aazlHbISPmutS84L8khr87OsQZoIsqspL64unsRJfZspgAJ59uOL82KvTXQC94ACNvVCtCTI/zF24TWbjdKXEdRKYEL4pUXMt9+uKqu8jxSxfuJBV0Z0HbZlAQcWnjEeef/sCkDuBcnchzJ00pCWCiDuuX9gWDgx2SIVIaFwNqUO8FW3U5a6yGQoUeLMDV1zAw5UHrgvAiCBVaq/fE3qKgE4FtSAE5iJQB/xtuzx4N/mpwVRii/euyNRXUJdgdJYJ/RVdDuRekeUxRLH4Q1MEFDCa1il7r09tkHCMtoXjbz5U1BpVb2t0VqL5OTbefUrcd4KR6m7jWa9gq8sj0uV6J+/nwDNm+EDqB1O6Ys1hdaxZ/GeC6nj+2qsTtsRzgQbHpNP6trz9/JmMrVSiu5gkFrUfxm0IImX243UwzJq6GiTEZOajDSviDIs5yV8rAbG4sHLNT9iU0w3p6/rfzmoGtl9svVOYpW8H7wqnStiVusxrV2smy6OjHiZMEibycwIlmw3q9nTBMnRn0/ketwgbSXcueKGE BTTjbdaE kwRRaSctQvk4rtmI7W4z3b+cYwpW9Ka+0q/YrAd6d4L7e6VUaDbNyuspZ4JX8umqPN5/PjGHjreW+ZweT/M/O2fLK1vtXMrFwxktQwb410wGgF2GvnuJ3OYIA/X5mMHHChywCPVBMJ4ejLAGvwwSaweUQ4obGuxXCoWVcDuoA6O1sONdxFZMUaodgiBigAFAJJpUnN7q40GrxzaDh5EeuSjOt0ApYyTQN6tKzR1gMUjBFIwor+74dLFQDa2b5RVPFjrEaeUAri3kXMF5qBxYLzvQJoVZN5EH4fUidIHFcMNPKp589v/3+lGO34DjZJynO+BeohY295GvixBBPHQTXyZS01XBG8XdissLRLfnY6z6HxC10tn+CVHvOl69wknpM/VZ89AEYtga9lFB5ed9TxsITmQ1u8C74jYs0b62CKVsNsm+y4eMqElE/sCTj8is7qUfAly+g8LkgirQ0odcAh1nuZSUAfLNYLsfySzE1otZdvwC/K8YqQAqstuHmE+hkLNyXbaNk4Zi6BBHVyxNvRM+fnTo40cgfh6uacbF37Kwfahg1rZ5gR+a4dXbB6AZ6IV9s+Tg3teAeXfT+SNpgoOA/rMGeLQAAya2+AkJaASBa864s2wkMLS24jQ1dkZCOjf1o1ajSD1HO4OkE6LMWQgmVysCEw3yA8i08hXN653B0KMSOh8vF52H5gQON58sbNzw6EUJW3h12DNS02Rmj8zTc1w== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[tip:x86/mm,v3,1/3] x86/mm: Use IPIs to synchronize LAM enablement
|
expand
|
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index cda2918f88f99..baded5b4907c9 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -831,17 +831,13 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits) return -EBUSY; } - if (!nr_bits) { - mmap_write_unlock(mm); - return -EINVAL; - } else if (nr_bits <= LAM_U57_BITS) { - mm->context.lam_cr3_mask = X86_CR3_LAM_U57; - mm->context.untag_mask = ~GENMASK(62, 57); - } else { + if (!nr_bits || nr_bits > LAM_U57_BITS) { mmap_write_unlock(mm); return -EINVAL; } + mm->context.lam_cr3_mask = X86_CR3_LAM_U57; + mm->context.untag_mask = ~GENMASK(62, 57); on_each_cpu_mask(mm_cpumask(mm), enable_lam_func, mm, true); set_bit(MM_CONTEXT_LOCK_LAM, &mm->context.flags);