git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] cygwin: set write permission before unlink

From
RTRei Thiessen <rei.thiessen@gmail.com>
Date
Jun 29, 2011, 18:48 UTC
Message-ID
<BANLkTincfBvDBYYLGJe-m5hknvCVdmMUww@mail.gmail.com>
In-Reply-To
<09c0b1900a67bd1f701c0b23954a34ab.squirrel@mail.localhost.li>

Another point of concern is that the user might have specifically set the read-only flag only certain files to protect them from changes/deletion, but after the patch, git can delete them with impunity. But then, a file's permission isn't supposed to matter to unlink() anyways. Interestingly, Cygwin's packaged unlink command-line utility will delete read-only files, so Cygwin's attempt to fake permissions through the read-only flag when a filesystem is mounted with "noacl" seems to be inconsistent.

I'll leave this issue up to Cygwin's package maintainer for git.

Regards, Rei

2011/6/29 Christof Krüger <git@christof-krueger.de>:
Show 19 quoted lines
>> +#undef unlink
>> +int cygwin_unlink(const char *pathname)
>> +{
>> +     /* "read-only" files can't be unlinked */
>> +     chmod(pathname, 0666);
>> +     return unlink(pathname);
>> +}
>
> I've no idea on how cygwin maps file permissions to the underlying
> filesystem, but the above raised my attention. Doesn't chmodding the file
> to 0666 open a small windows where "group" and "other" users have read
> access to the file? This might be unwanted by the user and could be
> exploited by some attacker listening for changes on that file.
> Or am I too paranoid?
>
> Regards,
>  Chris
>
>
Previous: Christof Krüger
Message 3 of 3 in “cygwin: set write permission before unlink”
  1. cygwin: set write permission before unlinkRei Thiessen, Jun 29, 2011
  2. Christof KrügerJun 29, 2011
  3. Rei ThiessenJun 29, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.