From patchwork Mon Mar 20 08:16:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Huey X-Patchwork-Id: 9634583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4C126020B for ; Mon, 20 Mar 2017 16:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 974E227CAF for ; Mon, 20 Mar 2017 16:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BB5E27F8C; Mon, 20 Mar 2017 16:54:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2104727CAF for ; Mon, 20 Mar 2017 16:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755960AbdCTQtT (ORCPT ); Mon, 20 Mar 2017 12:49:19 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33208 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753217AbdCTIRO (ORCPT ); Mon, 20 Mar 2017 04:17:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id p189so10480442pfp.0 for ; Mon, 20 Mar 2017 01:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=prR77uc6eNTxvNJc5vrzluPze5kiMmin7B/kAEro5JI=; b=A//yFR3FvvizXnsvdsWCHVGfa0pUhpf62BympEe93AiBucsSdpcamtFYJX2bAf6xUo BGZeX2/Sjh+hZPqGRgE8LEE60HBfW5n/X0jFOffspFF6OJKxEvOX+CsSGTf1wQGqc7Dy KQjuh0H3EVGbiFerHtEv0lgXUpRIicZTC7WUktn0geNK1bOEGC0BlFHN3qHdPweZIGvG 9JZkM3BOmtvwnLeYNAwzK0JTZkDvHH7F/+k2rjKfiYObmzkPn5RLuprrKKBPWgbSZ+8e 5y3MoJPfIjCoki3rfrDoyC0IWIgz/66xwECA/q3NPaww18oSY3NSZ4RrKCmiEsa2Fski oeXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=prR77uc6eNTxvNJc5vrzluPze5kiMmin7B/kAEro5JI=; b=FVm0tPGU/Ecne47pE7lSChyOgeCa3jBEJ0zFzwYMRgRnR4rNRor2GI5HWdiIpXh6Ix bswWgoA9Tj0jr5Y6Jgd2yfMWr5DWwvokG/V90G19YWGJ1gVwZ9hol2uG+a4Am7jUDgO/ n8BMLqG/6xR0YNiTYvnkj9qnydcpb05Ruw6Iateu0ZDnKG7ZrP6LQmhCnyU12rbf5pNI pkYil1n8XXiLFLTaLbjrNgbZOdj8w3kIWWTsDA9LEZdiOm2Y1p++Rv1H2NlpGB6U8EcZ TsaYnhdTDO3AZvU8uOAOjh3HHGwli0s41sAY7uEkgj12TPhNYUnUsCgDBvVQ8zdXwQ0D PElQ== X-Gm-Message-State: AFeK/H1kM4WeMwP8TaRS9gRA0MfKz2TPYpRRk4CO9APME5puJepI6cdrejWsGGe4jQFTzw== X-Received: by 10.84.173.228 with SMTP id p91mr37740817plb.121.1489997828728; Mon, 20 Mar 2017 01:17:08 -0700 (PDT) Received: from minbar.home.kylehuey.com (c-50-150-100-179.hsd1.ca.comcast.net. [50.150.100.179]) by smtp.gmail.com with ESMTPSA id m20sm7792029pgd.32.2017.03.20.01.17.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 01:17:08 -0700 (PDT) From: Kyle Huey X-Google-Original-From: Kyle Huey To: Robert O'Callahan , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Jeff Dike , Richard Weinberger , Alexander Viro , Shuah Khan , Dave Hansen , Borislav Petkov , Peter Zijlstra , Boris Ostrovsky , Len Brown , "Rafael J. Wysocki" , Dmitry Safonov , David Matlack , Nadav Amit , Andi Kleen , Grzegorz Andrejczuk Cc: linux-kernel@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, user-mode-linux-user@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH v16 05/10] x86/arch_prctl: Add do_arch_prctl_common Date: Mon, 20 Mar 2017 01:16:23 -0700 Message-Id: <20170320081628.18952-6-khuey@kylehuey.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170320081628.18952-1-khuey@kylehuey.com> References: <20170320081628.18952-1-khuey@kylehuey.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add do_arch_prctl_common() to handle arch_prctls that are not specific to 64 bit mode. Call it from the syscall entry point, but not any of the other callsites in the kernel, which all want one of the existing 64 bit only arch_prctls. Signed-off-by: Kyle Huey --- arch/x86/include/asm/proto.h | 3 +++ arch/x86/kernel/process.c | 6 ++++++ arch/x86/kernel/process_64.c | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h index 4e276f6cb1c1..8d3964fc5f91 100644 --- a/arch/x86/include/asm/proto.h +++ b/arch/x86/include/asm/proto.h @@ -31,4 +31,7 @@ void x86_report_nx(void); extern int reboot_force; +long do_arch_prctl_common(struct task_struct *task, int option, + unsigned long cpuid_enabled); + #endif /* _ASM_X86_PROTO_H */ diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 366db7782fc6..b12e95eceb83 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -545,3 +545,9 @@ unsigned long get_wchan(struct task_struct *p) put_task_stack(p); return ret; } + +long do_arch_prctl_common(struct task_struct *task, int option, + unsigned long cpuid_enabled) +{ + return -EINVAL; +} diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index e37f764c11cc..d81b0a60a45c 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -626,7 +626,13 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2) SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) { - return do_arch_prctl_64(current, option, arg2); + long ret; + + ret = do_arch_prctl_64(current, option, arg2); + if (ret == -EINVAL) + ret = do_arch_prctl_common(current, option, arg2); + + return ret; } unsigned long KSTK_ESP(struct task_struct *task)