From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758069AbcDHJjp (ORCPT ); Fri, 8 Apr 2016 05:39:45 -0400 Received: from mail-qg0-f68.google.com ([209.85.192.68]:33138 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755900AbcDHJjm (ORCPT ); Fri, 8 Apr 2016 05:39:42 -0400 MIME-Version: 1.0 In-Reply-To: <20160408071354.GB22579@gmail.com> References: <20160408071354.GB22579@gmail.com> From: Dmitry Safonov <0x7f454c46@gmail.com> Date: Fri, 8 Apr 2016 12:39:22 +0300 Message-ID: Subject: Re: [PATCH v3 2/7] x86/arch_prctl: Fix ARCH_GET_FS and ARCH_GET_GS To: Ingo Molnar Cc: Andy Lutomirski , Borislav Petkov , security@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Rudolf Marek , Denys Vlasenko , Thomas Gleixner , "H. Peter Anvin" , gorcunov@openvz.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-04-08 10:13 GMT+03:00 Ingo Molnar : > > * Andy Lutomirski wrote: > >> ARCH_GET_FS and ARCH_GET_GS attempted to figure out the fsbase and >> gsbase respectively from saved thread state. This was wrong: fsbase >> and gsbase live in registers while a thread is running, not in >> memory. > > So I'm wondering, the current code looks totally broken,what user-space code can > possibly use this? I checked glibc and Wine, and neither of them does. Wine uses > ARCH_SET_GS and glibc uses ARCH_SET_FS, but that's all - neither actually tries to > use the ARCH_GET_* reading APIs. Just FYI, CRIU also does not use ARCH_GET_{FS,GS}, only ARCH_SET_{FS,GS}. It gets them with the help of PTRACE_GETREGSET. > So for backporting purposes I'd be much happier about simply returning -EINVAL or > -ENOSYS, and we could re-introduce this code in v4.7.