bugGNU tar - Bugs: bug #54108, tar -C: directory without read...

 
 

bug #54108: tar -C: directory without read permission: use openat with O_PATH/O_SEARCH

Submitter:  kdevel <kdevel>
Submitted:  Tue 12 Jun 2018 06:27:50 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 12 Jun 2018 06:27:50 PM UTC, original submission:  

$ ./reproducer.sh
+ type mkdir touch chmod ls strace tar cc
mkdir is /bin/mkdir
touch is /usr/bin/touch
chmod is /bin/chmod
ls is /bin/ls
strace is /usr/bin/strace
tar is /bin/tar
cc is /usr/bin/cc
+ cc -std=gnu11 -Wall -pedantic openattest.c -o openattest
+ mkdir -p a/b
+ touch a/b/f1 a/b/f2 a/b/f3
+ chmod 0311 a
+ ls a/b
f1  f2  f3
+ strace -fFeopenat ./openattest a b
openat(AT_FDCWD, "a", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_PATH) = 3
openat returned 3
openat(3, "b", O_RDONLY)                = 4
openat returned 4
fdopendir returned 0xc3d010
entry <f2>
entry <f1>
entry <.>
entry <f3>
entry <..>
+++ exited with 0 +++
+ strace -fFeopenat tar -C a -cvf /dev/null b
openat(AT_FDCWD, "a", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 EACCES (Permission denied)
tar: a: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
+++ exited with 2 +++

kdevel <kdevel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44361:  reproducer.sh added by kdevel (285B - application/x-shellscript - reproducer, test code)
file #44362:  openattest.c added by kdevel (702B - text/x-csrc - reproducer, test code)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gray (Updated the item)
  • -email is unavailable- added by kdevel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-22 gray Open/ClosedOpen Closed
    2018-06-12 kdevel Attached File- Added reproducer.sh, #44361
        Attached File- Added openattest.c, #44362

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code