Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3926527imj; Tue, 12 Feb 2019 07:03:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IafnBm2W9gE+r/TUN2/xNjViRRFMeeq9Nsr+OSBYn2GNRGa7CWl/fWID0OynaKUL0MV0l19 X-Received: by 2002:a63:580f:: with SMTP id m15mr4030838pgb.342.1549983780067; Tue, 12 Feb 2019 07:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549983780; cv=none; d=google.com; s=arc-20160816; b=0UWfLdnrXQJFczNt29MehzksZdoFeN75VtL5X/7dV82IYlb0xiDutU3y5IFwv1CxYp r1yhnVa4T30uPQWns+TWZ9dxghEjBYlM+66xqz9+4sZfzP2/4z6Hil/Bmtz8si9ECKBP CJEop8UtaQV4aFFFvtDLX9T3HuAuhrmTfzuWEQswGerG0AQu1qKI9kAtk+bXMYSUdHQw kTdmk6JowUS5k9nM+/VQ77ViDz2mtFpxZP9fQcEirdyn+D6Bhqg+HggL+mIL02MDHApH D6bDAj/qUUWCMRPD4Rhoqou9jGAYZ1+uPp38aO40mmH4vbJghLsUz3kSoAGx5KWf9qdo I1DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4bipEG85DvMxlE/UsDnKVFPVryYnL+gbbKWtw53ErjY=; b=ncqNWXZvrGDGs2lUstzVzvOVFz42mgwSSakVSmRC4kDXqTGXdAiQFcmW7XO46g6abr /LkcchpuFx+jcXhr1k5XMElv2JHYnF/VbM8U2oVqJItKLu0x6LPg337tHH1/j88ykfZd z2HX7rXHtC5fM6wXbef58De9m1/GTytdUTze3sF7cjaM7S67c9MYCqAq0WprP+AdbsOA wCHs2Himx1YfyHPWzl977f18UBFB1Q/2++cwvmLiPHf8jFAhE1/pjJxuQP0HZZFeVnR2 U3zP4b90aHUg+95HO09uWrb+H3eKkEdRbEzQz6HQn7HseSQI+wjlohLDJQjF2YBz5ZI/ HRRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FTTfFT5o; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si4485064plp.257.2019.02.12.07.02.36; Tue, 12 Feb 2019 07:03:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FTTfFT5o; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730591AbfBLOzC (ORCPT + 99 others); Tue, 12 Feb 2019 09:55:02 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:44624 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbfBLOzA (ORCPT ); Tue, 12 Feb 2019 09:55:00 -0500 Received: by mail-yb1-f196.google.com with SMTP id b15so1110341ybn.11; Tue, 12 Feb 2019 06:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4bipEG85DvMxlE/UsDnKVFPVryYnL+gbbKWtw53ErjY=; b=FTTfFT5ohFBOFkA0Dq3y+fMb8A+au9e/mNLR/iALb5KqaDrnTqAsc0rVkhsF83SDUU wzR+RlvHeuSUKFMh8IttFwu0qxPHECdhUe8bnNx7H2xhEEGmMxQXLSB8l3S61WV4z1uu hxg2RlvAwCpWQZDGnwWqdHFlmjnEFNVAIGpcfN5aQIK4oqH3IUMioL8u7rgLzbkCfjQz xNJ5JxlbXcnF/+zrkgbfbAuPnu7Ffwd5/v1tsVLyxPTP/qkhGM8GyNQCKmha0pi9wjdJ zlh4OYhS80wm6upUKZAwNLLUROyerZ3Puptcerc7kpp0NYQ+j3PkUyQKxy2rS1nbp/WT R99w== 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:mime-version:content-transfer-encoding; bh=4bipEG85DvMxlE/UsDnKVFPVryYnL+gbbKWtw53ErjY=; b=ZSyJTzuvezTaYWVEha4PQfy8HiJEdLGbUXUazWwJPSJQQYMfDhKQLj//xvYqENOJ0z netY5guvff/mn+kajYiNNL+Ogmt4/2ZL2ADmb6tTFGECzhADrU274sQmLMZcCJhZ5AO+ zbdLfnnuqkjOOxz9xNj294v59wjk/4MiY135ANazBaGahmG2rdHxAl9RHVeB0ZRda/7h MgNIvSji6fMdmSfYzxCdCCvVRPbR/c+Q86Q50JJX55T00jpBv/PSzZxrO4sO8FXr0Th/ tE2gGscp2hQW+8Kn5PldtZ7RrOy3plAulbLxc+pAJwnCac+E/TWdjNRe07BA1DMlTK04 dzfQ== X-Gm-Message-State: AHQUAublVfYQoUaDDuumSwXJseDJ1yTlJnQ0HAky4IS6hHG3LfwtZaot zYgMWogoXPbRuJNgb8tDSk8= X-Received: by 2002:a25:a3c1:: with SMTP id e59mr3223403ybi.96.1549983299573; Tue, 12 Feb 2019 06:54:59 -0800 (PST) Received: from localhost.localdomain (c-73-120-18-128.hsd1.tn.comcast.net. [73.120.18.128]) by smtp.gmail.com with ESMTPSA id v134sm4987967ywv.90.2019.02.12.06.54.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 06:54:58 -0800 (PST) From: demiobenour@gmail.com To: Alexander Viro , Jeff Layton , "J. Bruce Fields" , linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)), linux-kernel@vger.kernel.org (open list) Cc: "Demi M. Obenour" Subject: [PATCH 3/4] Add AT_PATHSTATIC to linkat() Date: Tue, 12 Feb 2019 09:54:46 -0500 Message-Id: <20190212145450.2200-3-demiobenour@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212145450.2200-1-demiobenour@gmail.com> References: <20190212145450.2200-1-demiobenour@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Demi M. Obenour" This has the same meaning as O_PATHSTATIC does in openat(), and has the same uses. --- fs/namei.c | 8 +++++++- include/uapi/linux/fcntl.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 4c90f265c103..b47f89af00f2 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4291,8 +4291,14 @@ int do_linkat(int olddfd, const char __user *oldname, int newdfd, how = LOOKUP_EMPTY; } - if (flags & AT_SYMLINK_FOLLOW) + if (flags & AT_SYMLINK_FOLLOW) { + if (flags & AT_PATHSTATIC) + return -EINVAL; how |= LOOKUP_FOLLOW; + } + + if (flags & AT_PATHSTATIC) + how |= LOOKUP_NEVER_FOLLOW; retry: error = user_path_at(olddfd, oldname, how, &old_path); if (error) diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h index 6448cdd9a350..a2f65635c8fc 100644 --- a/include/uapi/linux/fcntl.h +++ b/include/uapi/linux/fcntl.h @@ -89,6 +89,7 @@ #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ +#define AT_PATHSTATIC 0x8000 /* Do not follow symbolic links anywhere. */ #endif /* _UAPI_LINUX_FCNTL_H */ -- 2.20.1