<font size=2 face="sans-serif">Unfortunately there is always a window
of time between testing the file and acting on the file's pathname.</font><br><font size=2 face="sans-serif">At any moment after testing (finding)
... the file could change, or the same pathname could be pointing to a
different inode/file.</font><br><br><font size=2 face="sans-serif">That is a potential problem with just
about every Unix file utility and/or script you put together with the standard
commands...</font><br><font size=2 face="sans-serif">find ... | xargs ...<br></font><br><font size=2 face="sans-serif">mmapplypolicy has the -e option to narrow
the window by retesting just before executing an action.</font><br><br><font size=2 face="sans-serif">Of course it's seldom a real problem
-- you have to think about scenarios where two minds are working within
the same namespace of files</font><br><font size=2 face="sans-serif">and then they are &nbsp;doing so either
carelessly without communicating &nbsp;or one is &nbsp;deliberately trying
to cause trouble for the other!</font><br><br><img align=left src=cid:_1_0F3AFA180F3AF7AC007791EB85257FFB alt="Marc A Kaplan" style="border:0px solid;"><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Aaron Knister &lt;aaron.s.knister@nasa.gov&gt;</font><br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">&lt;gpfsug-discuss@spectrumscale.org&gt;</font><br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">07/25/2016 03:51 PM</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [gpfsug-discuss]
GPFS API O_NOFOLLOW support</font><br><font size=1 color=#5f5f5f face="sans-serif">Sent by: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">gpfsug-discuss-bounces@spectrumscale.org</font><br><hr noshade><br><br><br><tt><font size=2>Thanks Marc. In my mind the issue is a timing one
between the moment the <br>policy engine decides to perform an action on a file (e.g. matching the
<br>path inode/gen number with that from the inode scan) and when it <br>actually takes that action by calling an api call that takes a path as
<br>an argument. Your suggestion in #3 is the route I think I'm going to <br>take here since I can call acl_get_fd after calling open/openat with <br>O_NOFOLLOW.<br><br>On 7/24/16 11:54 AM, Marc A Kaplan wrote:<br>&gt; Regarding &quot;policy engine&quot;/inodescan and symbolic links.<br>&gt;<br>&gt; 1. Either the MODE and MISC_ATTRIBUTES properties (SQL variables)
can be<br>&gt; tested to see if an inode/file is a symlink or not.<br>&gt;<br>&gt; 2. Default behaviour for mmapplypolicy is to skip over symlinks. &nbsp;You<br>&gt; must specify...<br>&gt;<br>&gt; *DIRECTORIES_PLUS which ...*<br>&gt;<br>&gt; Indicates that non-regular file objects (directories, symbolic links,<br>&gt; and so on) should be included in<br>&gt; the list. If not specified, only ordinary data files are included
in the<br>&gt; candidate lists.<br>&gt;<br>&gt; 3. You can apply Linux commands and APIs to GPFS pathnames.<br>&gt;<br>&gt; 4. Of course, if you need to get at a GPFS feature or attribute that
is<br>&gt; not supported by Linux ...<br>&gt;<br>&gt; 5. Hmmm... on my Linux system `setfacl -P ...` does not follow symlinks,<br>&gt; but neither does it set the ACL for the symlink...<br>&gt; &nbsp; &nbsp;Googling... some people consider this to be a bug, but
maybe it is a<br>&gt; feature...<br>&gt;<br>&gt; --marc<br>&gt;<br>&gt;<br>&gt;<br>&gt; From: &nbsp; &nbsp; &nbsp; &nbsp;Aaron Knister &lt;aaron.s.knister@nasa.gov&gt;<br>&gt; To: &nbsp; &nbsp; &nbsp; &nbsp;&lt;gpfsug-discuss@spectrumscale.org&gt;<br>&gt; Date: &nbsp; &nbsp; &nbsp; &nbsp;07/22/2016 06:37 PM<br>&gt; Subject: &nbsp; &nbsp; &nbsp; &nbsp;Re: [gpfsug-discuss] GPFS API
O_NOFOLLOW support<br>&gt; Sent by: &nbsp; &nbsp; &nbsp; &nbsp;gpfsug-discuss-bounces@spectrumscale.org<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt;<br>&gt;<br>&gt; Thanks Yuri! I do wonder what security implications this might have
for<br>&gt; the policy engine where a nefarious user could trick it into performing<br>&gt; an action on another file via symlink hijacking. Truthfully I've been<br>&gt; more worried about an accidental hijack rather than someone being<br>&gt; malicious. I'll open an RFE for it since I think it would be nice
to<br>&gt; have. (While I'm at it, I think I'll open another for having chown
call<br>&gt; exposed via the API).<br>&gt;<br>&gt; -Aaron<br>&gt;<br>&gt; On 7/22/16 3:24 PM, Yuri L Volobuev wrote:<br>&gt;&gt; In a word, no. I can't blame anyone for suspecting that there's
yet<br>&gt;&gt; another hidden flag somewhere, given our track record, but there's<br>&gt;&gt; nothing hidden on this one, there's just no code to implement<br>&gt;&gt; O_NOFOLLOW. This isn't Posix, and we just never put it in. This
would be<br>&gt;&gt; a reasonable thing to have, so if you feel strongly enough about
it to<br>&gt;&gt; open an RFE, go for it.<br>&gt;&gt;<br>&gt;&gt; yuri<br>&gt;&gt;<br>&gt;&gt; Inactive hide details for &quot;Knister, Aaron S. (GSFC-606.2)[COMPUTER<br>&gt;&gt; SCIENCE CORP]&quot; ---07/21/2016 09:05:11 AM---Hi Everyone, I've&quot;Knister,<br>&gt;&gt; Aaron S. (GSFC-606.2)[COMPUTER SCIENCE CORP]&quot; ---07/21/2016
09:05:11<br>&gt;&gt; AM---Hi Everyone, I've noticed that many GPFS commands (mm*acl,mm*attr)<br>&gt;&gt; and API calls (in particular the<br>&gt;&gt;<br>&gt;&gt; From: &quot;Knister, Aaron S. (GSFC-606.2)[COMPUTER SCIENCE CORP]&quot;<br>&gt;&gt; &lt;aaron.s.knister@nasa.gov&gt;<br>&gt;&gt; To: gpfsug main discussion list &lt;gpfsug-discuss@spectrumscale.org&gt;,<br>&gt;&gt; Date: 07/21/2016 09:05 AM<br>&gt;&gt; Subject: [gpfsug-discuss] GPFS API O_NOFOLLOW support<br>&gt;&gt; Sent by: gpfsug-discuss-bounces@spectrumscale.org<br>&gt;&gt;<br>&gt;&gt; ------------------------------------------------------------------------<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Hi Everyone,<br>&gt;&gt;<br>&gt;&gt; I've noticed that many GPFS commands (mm*acl,mm*attr) and API
calls (in<br>&gt;&gt; particular the putacl and getacl functions) have no support for
not<br>&gt;&gt; following symlinks. Is there some hidden support for gpfs_putacl
that<br>&gt;&gt; will cause it to not deteference symbolic links? Something like
the<br>&gt;&gt; O_NOFOLLOW flag used elsewhere in linux?<br>&gt;&gt;<br>&gt;&gt; Thanks!<br>&gt;&gt;<br>&gt;&gt; -Aaron_______________________________________________<br>&gt;&gt; gpfsug-discuss mailing list<br>&gt;&gt; gpfsug-discuss at spectrumscale.org<br>&gt;&gt; </font></tt><a href="http://gpfsug.org/mailman/listinfo/gpfsug-discuss"><tt><font size=2>http://gpfsug.org/mailman/listinfo/gpfsug-discuss</font></tt></a><tt><font size=2><br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; gpfsug-discuss mailing list<br>&gt;&gt; gpfsug-discuss at spectrumscale.org<br>&gt;&gt; </font></tt><a href="http://gpfsug.org/mailman/listinfo/gpfsug-discuss"><tt><font size=2>http://gpfsug.org/mailman/listinfo/gpfsug-discuss</font></tt></a><tt><font size=2><br>&gt;&gt;<br>&gt;<br>&gt; --<br>&gt; Aaron Knister<br>&gt; NASA Center for Climate Simulation (Code 606.2)<br>&gt; Goddard Space Flight Center<br>&gt; (301) 286-2776<br>&gt;<br>&gt; [attachment &quot;signature.asc&quot; deleted by Marc A Kaplan/Watson/IBM]<br>&gt; _______________________________________________<br>&gt; gpfsug-discuss mailing list<br>&gt; gpfsug-discuss at spectrumscale.org<br>&gt; </font></tt><a href="http://gpfsug.org/mailman/listinfo/gpfsug-discuss"><tt><font size=2>http://gpfsug.org/mailman/listinfo/gpfsug-discuss</font></tt></a><tt><font size=2><br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; gpfsug-discuss mailing list<br>&gt; gpfsug-discuss at spectrumscale.org<br>&gt; </font></tt><a href="http://gpfsug.org/mailman/listinfo/gpfsug-discuss"><tt><font size=2>http://gpfsug.org/mailman/listinfo/gpfsug-discuss</font></tt></a><tt><font size=2><br>&gt;<br><br>-- <br>Aaron Knister<br>NASA Center for Climate Simulation (Code 606.2)<br>Goddard Space Flight Center<br>(301) 286-2776<br>_______________________________________________<br>gpfsug-discuss mailing list<br>gpfsug-discuss at spectrumscale.org<br></font></tt><a href="http://gpfsug.org/mailman/listinfo/gpfsug-discuss"><tt><font size=2>http://gpfsug.org/mailman/listinfo/gpfsug-discuss</font></tt></a><tt><font size=2><br><br></font></tt><br><BR>