From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>,
Christoph Lameter <cl@linux.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
Kees Cook <keescook@chromium.org>,
Andy Lutomirski <luto@amacapital.net>
Subject: Re: [GIT PULL] Please pull exec fix for v5.7
Date: Tue, 26 May 2020 15:32:10 -0500 [thread overview]
Message-ID: <87pnaq5tf9.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <CAHk-=wh5cddDjyS2Av57Oc=qaowkx0XrtuJN=sErcq08qpnb7w@mail.gmail.com> (Linus Torvalds's message of "Tue, 26 May 2020 12:09:16 -0700")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Tue, May 26, 2020 at 11:42 AM Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>>
>> While working on my exec cleanups I found a bug in exec that winds
>> up miscomputing the ambient credentials during exec. Andy appears
>> as to credentials are computed for both the script and the interpreter.
>
> Can you rephrase that?
yes.
The sentence should have read:
"Andy appears to have to been confused as to why credentials are computed
for both the script and the interpreter."
If that is not enough ask and I will rewrite and resend the pull
request.
> I tried to figure out what you were trying to say, and I can't. I
> suspect a whole line or two is missing, or you were re-writing that
> thing and stopped in the middle or something.
>
> I'm also somewhat confused by your placement of that
>
> new->cap_ambient = old->cap_ambient;
I am restoring the work usually done by prepare_exec_creds, that
happens to get messed up when cap_bprm_set_creds is called multiple
times.
Since that happens before cap_brpm_set_creds is ever called I figured
doing it at the top of the function in case there is something subtle
is the path to safety and reliability, especially if the code will
be backported.
I don't see us touching cap_ambient anywhere except the line that does:
/* File caps or setid cancels ambient. */
if (has_fcap || is_setid)
cap_clear(new->cap_ambient);
But I am human and miss things occasionally.
> which doesn't seem to make a lot of sense. It's before the code even
> checks that the old ambient is valid, which I guess doesn't really
> matter (an error is an error, and the newly set state will not be used
> in that case), but aside from that it's just in an odd place.
>
> It's not near any other code that affects the new capabilities.
> Wouldn't it have made more sense to do this where we then clear
> cap_ambient if it's a setid binary?
That was my first thought but then I got defensive.
I think setting new->cap_ambient unconditionally at the top of the
function is the most robust way to code it. (see above).
The distance for other code clearing variables is also a mirage. The
get_file_caps function 3 lines down in it's first line clears
new->cap_permitted.
> So this pull just confuses me for a couple of reasons - I'm not saying
> it's wrong, but at a minimum I'd like to get a merge message that
> makes more sense..
I am going to dash to get my allergy injection today, and then come
back and address whatever concerns you might have.
Eric
next prev parent reply other threads:[~2020-05-26 20:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 18:38 [GIT PULL] Please pull exec fix for v5.7 Eric W. Biederman
2020-05-26 19:09 ` Linus Torvalds
2020-05-26 20:32 ` Eric W. Biederman [this message]
2020-05-26 21:32 ` Linus Torvalds
2020-05-27 18:10 ` pr-tracker-bot
-- strict thread matches above, loose matches on Subject: below --
2020-05-17 16:05 Eric W. Biederman
2020-05-17 20:15 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pnaq5tf9.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=cl@linux.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=serge@hallyn.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox