Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp683229yba; Thu, 9 May 2019 04:30:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/csnCq4rmzzKdWd246S4yQmm1pd4rah86F9hH3FGo/OFu3c5v7553opckO691nN7p+OxP X-Received: by 2002:a63:6a41:: with SMTP id f62mr4717221pgc.392.1557401447119; Thu, 09 May 2019 04:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557401447; cv=none; d=google.com; s=arc-20160816; b=PI43G2NmpttFvExkPfGxu8Il2CJ0R0OIrw3UQR+qUqvw6fJJtxik85D0083KstpI4r GNIYFWRcQgCFouFV0usX+1aUlWGfVpItLn6rGaAiRa1odZdXMzVNbZG0aiNplPBjFUUK nELPHsssVdUSEduTEWVdSUvAC32tRkEyQeknrjSwFlYE0NGobuthboq7/XshzORxts2W hvpX7pq6a/MHcJ9iAQUBggBNsvjmbT1bGK83bSSy8c4C9de+IWLsKqFMdQA5J1x27kQl u3nvK+O8FWDf6B3AgPFn94jNcTUG2Tmh7iDNkJtfiEAz+kbphZ3ukkDEeyV1U03PZkY4 LnOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=t7ixIgwC/c2yPMX3jDjhfuau66IscYKlM77bMZfH70M=; b=zU7YoyWo0/EfKphN/wsolmGD8iqgUN4AqInQVIe+xWXOYNObClEQO1a9fZiFIyDO6/ VYXBiqVhk1/dsuPX5x+gT90iPrn9nxoIjPMXZ3vN/r7zf/7j+85qGZcTXJFviF9nKCSX YS2FA/cd93WFh87ZdqbgyibACXp0o3Q/2tORnv6cH/eRYzRjw3G/9euB0fwYxzDZcPau U1hlPoap7AdHdeYPINuu3rpkbinHa847uHuPyJTqRylPsFr+rcTfXspjLVNxhMC6Un0D yi6JsKPOD5ttVksgX/eeUGtBKa8jtoIgyJPAtTArPVZD82g3sGGy8xEdr355Hcw/mIFg RdJQ== 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 e6si2755113pgj.590.2019.05.09.04.30.30; Thu, 09 May 2019 04:30:47 -0700 (PDT) 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 S1726704AbfEIL2J (ORCPT + 99 others); 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 Content-Type: text/plain X-Originating-IP: [10.204.65.154] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.17.1