From patchwork Thu May 9 11:24:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 10937021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9E07933 for ; Thu, 9 May 2019 11:28:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 992EA283C9 for ; Thu, 9 May 2019 11:28:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BC0028A4B; Thu, 9 May 2019 11:28:14 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 2465A283C9 for ; Thu, 9 May 2019 11:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726653AbfEIL2J (ORCPT ); Thu, 9 May 2019 07:28:09 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:32928 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725872AbfEIL2J (ORCPT ); Thu, 9 May 2019 07:28:09 -0400 Received: from lhreml703-cah.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 6FC508F0FA1104671975; Thu, 9 May 2019 12:28:07 +0100 (IST) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.154) by smtpsuk.huawei.com (10.201.108.44) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 9 May 2019 12:27:57 +0100 From: Roberto Sassu To: CC: , , , , , , , , , , , , , , , Roberto Sassu Subject: [PATCH v2 1/3] fs: add ksys_lsetxattr() wrapper Date: Thu, 9 May 2019 13:24:18 +0200 Message-ID: <20190509112420.15671-2-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190509112420.15671-1-roberto.sassu@huawei.com> References: <20190509112420.15671-1-roberto.sassu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.204.65.154] X-CFilter-Loop: Reflected Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similarly to commit 03450e271a16 ("fs: add ksys_fchmod() and do_fchmodat() helpers and ksys_chmod() wrapper; remove in-kernel calls to syscall"), this patch introduces the ksys_lsetxattr() helper to avoid in-kernel calls to the sys_lsetxattr() syscall. Signed-off-by: Roberto Sassu --- fs/xattr.c | 9 ++++++++- include/linux/syscalls.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/xattr.c b/fs/xattr.c index 0d6a6a4af861..422b3d481edb 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -484,11 +484,18 @@ SYSCALL_DEFINE5(setxattr, const char __user *, pathname, return path_setxattr(pathname, name, value, size, flags, LOOKUP_FOLLOW); } +int ksys_lsetxattr(const char __user *pathname, + const char __user *name, const void __user *value, + size_t size, int flags) +{ + return path_setxattr(pathname, name, value, size, flags, 0); +} + SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname, const char __user *, name, const void __user *, value, size_t, size, int, flags) { - return path_setxattr(pathname, name, value, size, flags, 0); + return ksys_lsetxattr(pathname, name, value, size, flags); } SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index e446806a561f..b639f13cd1f8 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -1260,6 +1260,9 @@ int ksys_ipc(unsigned int call, int first, unsigned long second, unsigned long third, void __user * ptr, long fifth); int compat_ksys_ipc(u32 call, int first, int second, u32 third, u32 ptr, u32 fifth); +int ksys_lsetxattr(const char __user *pathname, + const char __user *name, const void __user *value, + size_t size, int flags); /* * The following kernel syscall equivalents are just wrappers to fs-internal