Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp589823ybl; Fri, 13 Dec 2019 01:13:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxmYKAfYZs+pwro640DMO7LjHJ0oO5t5Zqq/RN9Ur0fAF45ifciXqhacyzGezqI6625a3G0 X-Received: by 2002:a9d:6c8:: with SMTP id 66mr13500665otx.271.1576228426384; Fri, 13 Dec 2019 01:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576228426; cv=none; d=google.com; s=arc-20160816; b=PwxvQjOXgn/RPyq2sO4Fuh2WAm+0KGFvMgF68n4UfrI8XXaZNsuGpZUmcB2iVF6627 isyTM/JhOPF618VrnE88cVia/R/uEC9gzVY0z8XemeSaoXJX86pPkQAY3femdLwaST+a xV/SavXokIcwGtcQnof19chwdyIsOGwiUF8cbqTr6U+A8kn4Qbg9SB9QWuPr5f5qsjzc 8aAsVahD6usv/Izg46uAoZQ0m/W01Ed9p0pzgW1xsSw7COmx9iG/CMgwylNVC+u+wz6i X8XPw8xFztY2Kgh0JR2tWDntdGKpzP5r4/xFWg8C8FBJkMBiOud1ueHUfbuU8vYXzltE Nr+w== 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 :in-reply-to:references:mime-version; bh=boyT2FRvtXCey3JAl40/GUXK1xmwvOHALK/JYBUMitA=; b=dhZQtEiIQlRiHPi8SgIJ6G4xrsDtTKwahwxFVLw6xsTLEj1N173JZE4HmlH4mEG54O N2kbAcnxOSyp35Ygegx2fK/v7mEaRqzkj1tcVBNzNI2jtjDEaqcq3UnraFge0Y5Ql7B/ ZTRi7Lo0lT9+S5/wNGOGH9OoBErTa64SQDgWRQVhl4TtvZ9BUW3wrGS3ylTs4TgNRSoW 4m7oK3ej+nVR/U9lpfEytOOTLdSFPtDtq3pW9jh04cmyzsjxdsec+a3vR3doA1Ene/HQ JUCAp6dLPzbhCWuMN9mpwUCWwoz5DbkG0x+26/tDz0inMW0/385FRuFahW3ne9KZfYaG w5mw== 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 3si4931981oir.132.2019.12.13.01.13.35; Fri, 13 Dec 2019 01:13:46 -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 S1726623AbfLMJMt (ORCPT + 99 others); Fri, 13 Dec 2019 04:12:49 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:58847 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbfLMJMs (ORCPT ); Fri, 13 Dec 2019 04:12:48 -0500 Received: from mail-qv1-f53.google.com ([209.85.219.53]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MzQbw-1hkY503oH2-00vNe9; Fri, 13 Dec 2019 10:12:47 +0100 Received: by mail-qv1-f53.google.com with SMTP id z3so572126qvn.0; Fri, 13 Dec 2019 01:12:46 -0800 (PST) X-Gm-Message-State: APjAAAVdjH0AM8OalO420MJ9FsonYzOw7ARt4hV8ClWhQNe/3zsT85CZ jhDXXQcHOj6FyiMtjTuPQXWyXl3G3KFO6lzW2t0= X-Received: by 2002:a0c:bd20:: with SMTP id m32mr12468089qvg.197.1576228365743; Fri, 13 Dec 2019 01:12:45 -0800 (PST) MIME-Version: 1.0 References: <1576225834-16389-1-git-send-email-sunguoyun@loongson.cn> In-Reply-To: <1576225834-16389-1-git-send-email-sunguoyun@loongson.cn> From: Arnd Bergmann Date: Fri, 13 Dec 2019 10:12:29 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] MIPS: Add get_thread_area syscall To: Guoyun Sun Cc: Ralf Baechle , Paul Burton , James Hogan , Peter Zijlstra , Christian Brauner , Heiko Carstens , David Howells , Geert Uytterhoeven , Catalin Marinas , "open list:BROADCOM NVRAM DRIVER" , "linux-kernel@vger.kernel.org" , Tiezhu Yang , Xuefeng Li Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:R7d2KjzKhAJPtKeDSv8HU1uxOAiuqRUm+tslKIJMlNfBnfaP/06 Wc8wWq65uFcILTaFbdT7pedB99ynSOhtL9boFpHxbPhbXz3pcieG7JG4s1C7smgX/fA3swK YUo7u3RjvHpV5R8MBuiXPT11eYXAQCBjctuNcr8A92WfuKcM3htxlwZQzdcsguY+lkJPgI0 OkTBGa4TSeIssgSvIjOkg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:D1U26v/T0Lc=:vGYDxyAHHQhrTtyDpF1QDd NFC6D8hMRY7sFvGCTDYXZEUIoX9Fy3ruXTsa4v4u/z7BsyEeN+7tTs39DNEAleMg7cVUpe1DE iqKDv8bCQ6QRlkr2PULHN/TP6smY6ckhpZw7BXnG3/yTy3y4hA+aad4ibbRFUz8RFfgtVLmel MQ92HK4/KhbVhStjLTgxQ1bOno1ivK1alDYDeKazucm7xh4KF8AIn/j+HYFdLnaLrn8ZAFBrw HI3Eh9OcPV1xfg5jvAmgTfdRQtyqZtS65dODXTblDFiwVdQhUUXYRo5FYhMwUSrMA5q6BE8Lx LHUKFWvGZhq8V8RSV7Y+9oAvvedROybewRwelMiOswXCWwJtA9kZDyQMUWvEB6hr7X0y32N2L 6mQ1GVIuodyhr6eEqyRn4PVK/m2iae2+HYv1CvFIOjTw0BTWMO0Rgf6qoQWpawIrq4K2BFyDJ zhGXmYIgCNnznPiO5rRoPTYMmVKQrgYEEER5dIM2GSujuj/v5OyIyYzsTeSkGJltkSfRYEZeE dP/aEGeuIiQ4sDUDWOmbvjYqwOztbrpI5TrUpdrPGFwdaTBX1R4Q/ra8D0oX6pUcxLg8wI698 9zB+/1tRtBvaevp9WMNzCbrJmjnqKXssQD3hUmEi7p4V/IQn4rPutsgRqoJngFIbA6STYp9hE FcyyXOv2Z9qw7qNsEVeRRaL8h6iyovUtmy5PXPhdP9WLhg2DL9YFlKmOrtGLBkERQfWK0tmHP 7nFuLnD9FTYsv9sBnp+JqOoDX364C1g1ViPO127ORJu7Zvr0340Rt4uvANgJpK2LbBu3MHOPy uin5cfbEm5VILQUAnyqOzsnocqGWR/mkPxoAQ1TlYRM9AZNWzsOkAl4OyGvjKm6pfHljoeu2P YlyLBKRXkApEcT2jn12w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 13, 2019 at 9:30 AM Guoyun Sun wrote: Thanks for fixing the numbers. On second look, I saw another problem: > diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c > index c333e57..20bf4c5 100644 > --- a/arch/mips/kernel/syscall.c > +++ b/arch/mips/kernel/syscall.c > @@ -94,6 +94,16 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) > return 0; > } > > +SYSCALL_DEFINE1(get_thread_area, unsigned long __user *, u_info) > +{ > + struct thread_info *ti = task_thread_info(current); > + > + if (copy_to_user(u_info, &(ti->tp_value), sizeof(ti->tp_value))) > + return -EFAULT; > + > + return 0; > +} > + This won't work for compat mode, when tp_value is a different size in kernel and user space. You could either add a COMPAT_SYSCALL_DEFINE1() variant, or handle it like if (in_compat_syscall()) return put_user(ti->tp_value, (__u32 *)u_info); return put_user(ti->tp_value, u_info); Arnd