Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp762127imn; Sat, 30 Jul 2022 01:56:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Vcu0j+TdC3UEDW1TdCiorXU+ttC29tYDl6o4c7uUccX7Em1McRYyiWqTmjeUWWtLXiF4p X-Received: by 2002:a17:90b:3e86:b0:1f2:e08b:7c42 with SMTP id rj6-20020a17090b3e8600b001f2e08b7c42mr7999360pjb.175.1659171389045; Sat, 30 Jul 2022 01:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659171389; cv=none; d=google.com; s=arc-20160816; b=TgjcSeLFBTT3Q7Po0FSL/2aPuRVB3BejoQIJVB31aJe0Prxj6s2gk27UZqpkiTGsHJ ksLgjrP97a/z99VjxUQKMlGUZG1BeQlcBEIxmRDS0BUVZKt+Vo54wkFO+ZfPMESiWrWx akQ9bahHaVO0yCAh1bfJN+tBHZSaTFDMHSWOQzo6vVMYOF+r8UqLeTGOf8h9VGISgdWa CRnkenQPwTr2Jh6nwt6OMszCYZQDMqjaIWVZMe+S5z2blgZtRmeL1aQS0PfDbyG3Sv/i UwkRnbGx0FakDhVnFLI+7peWWhdew8afhe1RxPn2ejRSpbbUUM/x55qfka0kDWDVrY8+ 6wrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Lpq6EhPNWYSKFs15nT7sEiVIoMgk+C378PhAkSDTkSk=; b=pJJPMgxT7MBXC9rGNMSCvq3H74TYPbX+kyGIWep/y9hk2v3oQMtTowcGnq84lu0+sl i4OXGVfZ6dPwUf5iRFXPhFuKVt/zjnctz/wt0z64zQBf71HHiKLCHmZfpom0O2T1K32o HS9n6I42N/TosJC/LB3RPn+i8PFOtTYAljlF19HovZbYMv9VgZ70FigKz1T5lvQVWO/9 w3bRb3FvCrWEUQw6QXGPdOOFUC00sg3MCw5i6HDXHTbVaRDX/0zz8ZJz/DBQHDGgg0Ou vo17AZ+GobZqpdENRAZy0Jry6zQ15yv4UMj7/jY74ScBtb5byAHhvJIFpFXWY/Agq5IH iPxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ELOPA818; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="07e4c/L8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np2-20020a17090b4c4200b001f2c5c02eb1si12155979pjb.117.2022.07.30.01.56.06; Sat, 30 Jul 2022 01:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ELOPA818; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="07e4c/L8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbiG3IVu (ORCPT + 99 others); Sat, 30 Jul 2022 04:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbiG3IVr (ORCPT ); Sat, 30 Jul 2022 04:21:47 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11BB3CFA; Sat, 30 Jul 2022 01:21:44 -0700 (PDT) Date: Sat, 30 Jul 2022 08:21:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1659169302; h=from:from:sender:sender:reply-to: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=Lpq6EhPNWYSKFs15nT7sEiVIoMgk+C378PhAkSDTkSk=; b=ELOPA818HCEmMAgRSIdeiVIxBeC4o9ONRFuIqWlFLTK/ke4/z3U93iMLRx7zZpqtXHAfYW GhpTf/mkbnFVUm9UFEFrdbPeB801OS0+jftLwfVrmtMjc6MM0PPj/+3k1R2Y1vXx2lyxsk zF+3ncvt/kRzZAqzOgmoEzMt42gS6zQV5ZRpvN9qjuGCM5b+JqZLAEdjkKBxOidHyHmgJ9 c0FQ3rKLtHqfta/MVOwOehWrrrqaCF6CTuHeWOWVKN0qEAWD1eBxatwG+NVSuQEXeA4f2p 0cgr059MAdEyakzcMMLA5AJ22Q0quMaZ6CwqUdBLHONPfy9ibqeY8Mpf7hakIQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1659169302; h=from:from:sender:sender:reply-to: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=Lpq6EhPNWYSKFs15nT7sEiVIoMgk+C378PhAkSDTkSk=; b=07e4c/L8v+rlxZCNj+R52HymCj85p/xuufOq/DoMvhIYZQiX30RVkMs7OE+eaIoZ+t6Ifd kWWl9R/HpRvDyNDA== From: "tip-bot2 for Mathieu Desnoyers" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] rseq: Kill process when unknown flags are encountered in ABI structures Cc: Mathieu Desnoyers , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220622194617.1155957-2-mathieu.desnoyers@efficios.com> References: <20220622194617.1155957-2-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Message-ID: <165916930066.15455.7617990662704399879.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 8da3d9b8590bc178752d4b72938745e9a6c4c416 Gitweb: https://git.kernel.org/tip/8da3d9b8590bc178752d4b72938745e9a6c4c416 Author: Mathieu Desnoyers AuthorDate: Wed, 22 Jun 2022 15:46:17 -04:00 Committer: Peter Zijlstra CommitterDate: Sat, 30 Jul 2022 10:14:18 +02:00 rseq: Kill process when unknown flags are encountered in ABI structures rseq_abi()->flags and rseq_abi()->rseq_cs->flags 29 upper bits are currently unused. The current behavior when those bits are set is to ignore them. This is not an ideal behavior, because when future features will start using those flags, if user-space fails to correctly validate that the kernel indeed supports those flags (e.g. with a new sys_rseq flags bit) before using them, it may incorrectly assume that the kernel will handle those flags way when in fact those will be silently ignored on older kernels. Validating that unused flags bits are cleared will allow a smoother transition when those flags will start to be used by allowing applications to fail early, and obviously, when they attempt to use the new flags on an older kernel that does not support them. Signed-off-by: Mathieu Desnoyers Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220622194617.1155957-2-mathieu.desnoyers@efficios.com --- kernel/rseq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rseq.c b/kernel/rseq.c index 81d7dc8..bda8175 100644 --- a/kernel/rseq.c +++ b/kernel/rseq.c @@ -176,7 +176,7 @@ static int rseq_need_restart(struct task_struct *t, u32 cs_flags) u32 flags, event_mask; int ret; - if (WARN_ON_ONCE(cs_flags & RSEQ_CS_NO_RESTART_FLAGS)) + if (WARN_ON_ONCE(cs_flags & RSEQ_CS_NO_RESTART_FLAGS) || cs_flags) return -EINVAL; /* Get thread flags. */ @@ -184,7 +184,7 @@ static int rseq_need_restart(struct task_struct *t, u32 cs_flags) if (ret) return ret; - if (WARN_ON_ONCE(flags & RSEQ_CS_NO_RESTART_FLAGS)) + if (WARN_ON_ONCE(flags & RSEQ_CS_NO_RESTART_FLAGS) || flags) return -EINVAL; /*