Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3121894pxy; Mon, 3 May 2021 15:58:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOVFvGr2XGNZKOCq1wxSNu/wbwb7hXt+DUEImxzfesGJGGyxcp9vJpWp/TH1DiTsYhFtyh X-Received: by 2002:a17:906:507:: with SMTP id j7mr18729197eja.151.1620082737917; Mon, 03 May 2021 15:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620082737; cv=none; d=google.com; s=arc-20160816; b=s8Wyk8XnpGRNbwh68C9PTG8JSZR2pOvIEJ1Efk8mg/RfdmYWWPJ1dy4dgLt2NJ9rQV eK6e/C6GoiShgVQvrsiBxlIs19Xj1sThBlmAllKDRyjVnmDHfOhlabcGgAnuuVVWspGO FBivqPNknJqxv5lcyOXug3rzdbfLqmzlQiVJYMO4Rc3QBm0HIX3l/fHDekE27bDzo8AO i0Ve1L8XQQDeyxlLELsaS2mgzdatB/9gWrMQhMsow6w5i6QMvvJlwBFUaUByW46iSPO2 LQsBkbp09VSROo3cYqGz/jxGZ7sbchobqe2dqm7oCcpX3FEOy3BPK2Pb9qgkDObkWehe VhbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=B84p/IJYuwcwlUo5VV9baLC5gQPtbfpdB7bWr7TSjiE=; b=Fx0JlcqKNIbp31xDs/yyEkr8QcD68sxID3TRxvFe0Vs2jERvCWdSObtvX+ulZPFjm3 F/LKUDFs0rCxebqI3kSyDvBj7tfs3UMatKE/9p72NVDL/7g+n8a1VxugGjhoNVZIDrIM PtygU2cvN7+s9uUcqzMkmgfhevfS4T/RB8x03UhTgZkxhdTAqtBlcJjv+u1w0ISiHJWE fs/khD3ISNpaYGy+ThSixku/hmjjNhLOrgKMKEI7iVUL3gCBMGfqfyCODQnpcEaU1ctV rJRxuoUcEQ5YkCECouw/D7ByLMAOF+80a6LSqI2sSHW0mXHLULavpLJzkEl+sx1g/CHQ 0tcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wNo43GJ1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lfgn04cV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si1072141eju.347.2021.05.03.15.58.33; Mon, 03 May 2021 15:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wNo43GJ1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lfgn04cV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229836AbhECW5Q (ORCPT + 99 others); Mon, 3 May 2021 18:57:16 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:50332 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbhECW5Q (ORCPT ); Mon, 3 May 2021 18:57:16 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620082581; 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=B84p/IJYuwcwlUo5VV9baLC5gQPtbfpdB7bWr7TSjiE=; b=wNo43GJ1Ca/eA1VjnpMc6U+NfvyAQmFCt1seHkbQgNw/rZNzGZCYq7b1tJiFxaTHqBjWsg dT1Be8HRs8Ma89lW8646O6sFmUEEdUNU3hCMpsfMd2hq0MZERdbFVEF5vJKO1+jMpl8StQ AbwO9J7Vs0mjVuyNCYKa9vED4ZhLlm1iA4oZTbz1xK/rQo1tGsQGEhxh1anEg6UEytPuIY fOdYre4a0J+pb9xzs5qPM6CcAYVVsn0WGZlRtEAIvhoeKyG2EkOEoJzUJl/WWLBReWvXdb HNYaBCJ8qc3G/wdwwdegB/SqNXe8lZe+nRpL74XuLeXLMfscAX0N3oUM20jXTA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620082581; 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=B84p/IJYuwcwlUo5VV9baLC5gQPtbfpdB7bWr7TSjiE=; b=lfgn04cVVhb7f9uTX9owNgFOmING8neTfDqK30SwQmJqQKmKa4bBmG3B+3uqHqyO1gQpqc tYaGIEVGogBnQjAw== To: Linus Torvalds , Andy Lutomirski Cc: Jens Axboe , Stefan Metzmacher , Linux Kernel Mailing List , io-uring , the arch/x86 maintainers Subject: Re: [PATCH] io_thread/x86: don't reset 'cs', 'ss', 'ds' and 'es' registers for io_threads In-Reply-To: References: <8735v3ex3h.ffs@nanos.tec.linutronix.de> <3C41339D-29A2-4AB1-958F-19DB0A92D8D7@amacapital.net> Date: Tue, 04 May 2021 00:56:20 +0200 Message-ID: <8735v3jujv.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 03 2021 at 15:08, Linus Torvalds wrote: > On Mon, May 3, 2021 at 2:49 PM Andy Lutomirski wrote: >> >> To be clear, I'm suggesting that we -EINVAL the PTRACE_GETREGS calls >> and such, not the ATTACH. I have no idea what gdb will do if this >> happens, though. > > I feel like the likelihood that it will make gdb work any better is > basically zero. > > I think we should just do Stefan's patch - I assume it generates > something like four instructions (two loads, two stores) on x86-64, > and it "just works". > > Yeah, yeah, it presumably generates 8 instructions on 32-bit x86, and > we could fix that by just using the constant __USER_CS/DS instead (no > loads necessary) since 32-bit doesn't have any compat issues. > > But is it worth complicating the patch for a couple of instructions in > a non-critical path? > > And I don't see anybody stepping up to say "yes, I will do the patch > for gdb", so I really think the least pain is to just take the very > straightforward and tested kernel patch. > > Yes, yes, that also means admitting to ourselves that the gdb > situation isn't likely going to improve, but hey, if nobody in this > thread is willing to work on the gdb side to fix the known issues > there, isn't that the honest thing to do anyway? GDB is one thing. But is this setup actually correct under all circumstances? It's all fine that we have lots of blurb about GDB, but there is no reasoning why this does not affect regular kernel threads which take the same code path. Neither is there an answer what happens in case of a signal delivered to this thread and what any other GDB/ptraced induced poking might cause. This is a half setup user space thread which is assumed to behave like a regular kernel thread, but is this assumption actually true? Thanks, tglx