Re: [hackers] [PATCH 1/3][sbase] chown: Ignore failure to find user/group name

From: Michael Forney <mforney_AT_mforney.org>
Date: Wed, 26 Jun 2019 11:32:23 -0700

On 2019-06-26, Richard Ipsum <richardipsum_AT_fastmail.co.uk> wrote:
> On Tue, Jun 25, 2019 at 04:55:10PM -0700, Michael Forney wrote:
>> I think the error is coming from
>> https://github.com/openbsd/src/blob/f84583fe5d7899ab1504dc1d58a04742db4a3058/lib/libc/gen/getgrent.c#L217.
>> If I run `touch /var/run/ypbind.lock` in my OpenBSD VM, it fixes the
>> issue.
>
> I see, so to preserve the existing behaviour you'd want to save errno
> before calling access, then restore afterward.

Yes, I think that would work.

>> I think this is unintended, since there appears to be some logic to
>> save and restore errno in grscan(). Looks like it was introduced in
>> https://github.com/openbsd/src/commit/b971f1acd7c34a49359ccefbe512e06f3826a939
>> (first released in OpenBSD 5.9).
>
> Right, exactly. I think the reason this doesn't break OpenBSD chown is
> because it uses `gid_from_group` and the implementation[1] for that
> actually ignores errno, if it didn't they might have spotted this issue
> themselves.
>
> Do you want to raise this with upstream or shall I?

If you don't mind, I'd appreciate it if you did.

> Yes I can see why you would rather not ignore errno to be fair.
> Maybe the better option is to see if the fix can be made in OpenBSD
> and then I could rework these patches?

Yes, that sounds like a good plan.

Thanks!
Received on Wed Jun 26 2019 - 20:32:23 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 26 2019 - 20:48:22 CEST