Received: by 10.223.176.46 with SMTP id f43csp1049625wra; Fri, 26 Jan 2018 11:00:39 -0800 (PST) X-Google-Smtp-Source: AH8x22562U/hXL2oSrfBDxyhbyA5Eld//tzq8QReMAo33H9mZEjYjr1zl56Zx5hxC/supN7A3qg9 X-Received: by 10.99.126.73 with SMTP id o9mr7501780pgn.429.1516993239159; Fri, 26 Jan 2018 11:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516993239; cv=none; d=google.com; s=arc-20160816; b=aOexUGCitrFo4YBR0hJsFgvvRPeloPsU4Xkt2P+f1r6jWcu+EAAMCLlLTejQP0J+X8 dNHVnMV8KDTv+siO7sR68718N2S6B0Us3FzhFy/OIUPTKtGBx5LvW71vMnQzhqakYqvx gZSv5ML+Tj27jClPzvTT34bEtE8P0cjN1LJKeF5sgTMhxw36fo+1rOLmnYeqsgCYWQWf 1MZQ8XcU1CqLjnZqmgjZA2NtwkrawKdAl6YeoiT+pDoVe/eYL3a0FgO4VXNXgALufBEQ A95H9eKg4pAtTIhkRIzdJNcjVhPU2wtC5Z2I1qKjWGu5VqD7NDhoCUOJZzIpOjXzjIp9 iQog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=3+k/fKtV7eEDBIkGlsKkc4CMYAoDlxNgfsCBRnO+JtQ=; b=fqgrIEvJM+dmpYQdl4ujcJYsKgk64YVTntv9vC6h4GFHcIDlzQnerS8azm7EfA6YeA UmhJN6qddkYGl9D4HKu6UrzlAk9XR+wCPGeoODBqUAs85SzGm+HRWRLUKfJkTK+J2VAl S3epMQu6Qvjl+rbsDtjK9geXdnzDucYkKYvpYy+9uLanTdPuEFhEzE3TSpNZkL1IWqaf Fg9r4grXY1rKE0iFcotvQyy0fVFHsqKmjblMoQHuZW+4md4vvpAUd5HISAKzrzhqLL0H w482JKfaAstItcyuIuztYjRpu2woulRKxh0Tg3E/jFjEJYQ5fzHwa5DN8BDkhDopyOfq SkOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si3300957pgc.824.2018.01.26.11.00.23; Fri, 26 Jan 2018 11:00:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752498AbeAZS77 (ORCPT + 99 others); Fri, 26 Jan 2018 13:59:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:60002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751666AbeAZS76 (ORCPT ); Fri, 26 Jan 2018 13:59:58 -0500 Received: from mail-it0-f44.google.com (mail-it0-f44.google.com [209.85.214.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 646B820C48 for ; Fri, 26 Jan 2018 18:59:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 646B820C48 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-it0-f44.google.com with SMTP id p139so1648918itb.1 for ; Fri, 26 Jan 2018 10:59:57 -0800 (PST) X-Gm-Message-State: AKwxytfHAew0k/H7z9+B2V+WfkQOavuTlkgC/o7P4vj2ggTfw54sKdSd FKCNmipjtiFfoEr2sTrWnk74OwmaUg0jM+6JClqQfA== X-Received: by 10.36.214.9 with SMTP id o9mr805222itg.132.1516993196793; Fri, 26 Jan 2018 10:59:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.137.84 with HTTP; Fri, 26 Jan 2018 10:59:36 -0800 (PST) In-Reply-To: References: <20180126153631.ha7yc33fj5uhitjo@xps> From: Andy Lutomirski Date: Fri, 26 Jan 2018 10:59:36 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: selftests/x86/fsgsbase_64 test problem To: Andy Lutomirski Cc: Dan Rue , Shuah Khan , Ingo Molnar , Dmitry Safonov , Borislav Petkov , "open list:KERNEL SELFTEST FRAMEWORK" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 26, 2018 at 8:22 AM, Andy Lutomirski wrote: > On Fri, Jan 26, 2018 at 7:36 AM, Dan Rue wrote: >> >> We've noticed that fsgsbase_64 can fail intermittently with the >> following error: >> >> [RUN] ARCH_SET_GS(0x0) and clear gs, then schedule to 0x1 >> Before schedule, set selector to 0x1 >> other thread: ARCH_SET_GS(0x1) -- sel is 0x0 >> [FAIL] GS/BASE changed from 0x1/0x0 to 0x0/0x0 >> >> This can be reliably reproduced by running fsgsbase_64 in a loop. i.e. >> >> for i in $(seq 1 10000); do ./fsgsbase_64 || break; done >> >> This problem isn't new - I've reproduced it on latest mainline and every >> release going back to v4.12 (I did not try earlier). This was tested on >> a Supermicro board with a Xeon E3-1220 as well as an Intel Nuc with an >> i3-5010U. >> > > Hmm, I can reproduce it, too. I'll look in a bit. I'm triggering a different error, and I think what's going on is that the kernel doesn't currently re-save GSBASE when a task switches out and that task has save gsbase != 0 and in-register GS == 0. This is arguably a bug, but it's not an infoleak, and fixing it could be a wee bit expensive. I'm not sure what, if anything, to do about this. I suppose I could add some gross perf hackery to the test to detect this case and suppress the error. I can also trigger the problem you're seeing, and I don't know what's up. It may be related to and old problem I've seen that causes signal delivery to sometimes corrupt %gs. It's deterministic, but it depends in some odd way on register state. I can currently reproduce that issue 100% of the time, and I'm trying to see if I can figure out what's happening.