bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do we intercept file saving or output to stdout directly


From: Robert Elz
Subject: Re: How do we intercept file saving or output to stdout directly
Date: Thu, 27 Aug 2020 05:26:46 +0700

    Date:        Wed, 26 Aug 2020 08:13:52 -0400
    From:        Greg Wooledge <wooledg@eeg.ccf.org>
    Message-ID:  <20200826121352.GN931@eeg.ccf.org>

  | The obvious guess is that it's to "prevent you from accidentally
  | overwriting a file".

That would be what one would normally assume, but Dale didn't
show what comes just before the open (this sys call trace is
from a different OS, so the format is different)

 28469  28469 xkbcomp  CALL  unlink(0x7f7fffffec7b)
 28469  28469 xkbcomp  NAMI  "/dev/stdout"
 28469  28469 xkbcomp  RET   unlink -1 errno 13 Permission denied
 28469  28469 xkbcomp  CALL  open(0x7f7fffffec7b,0xa01,0x1b6)
 28469  28469 xkbcomp  NAMI  "/dev/stdout"
 28469  28469 xkbcomp  RET   open -1 errno 17 File exists

If it was attempting to "prevent you from accidentally overwriting a file"
it is unlikely it would be unlinking it (or attempting to) first.

(0xa01 == O_EXCL|O_CREAT|O_WRONLY   0x1b6 == 0666).

If one were to execute xkbcomp as root (people, please don't)
then all of this would probably succeed, and replace /dev/stdout
with a regular file containing the xkbcomp output.

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]