From owner-freebsd-hackers@freebsd.org Fri Apr 23 08:47:10 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 580545E979A for ; Fri, 23 Apr 2021 08:47:10 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRSZx58LGz3tH7 for ; Fri, 23 Apr 2021 08:47:05 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-lf1-f49.google.com with SMTP id d27so19523590lfv.9 for ; Fri, 23 Apr 2021 01:47:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zKCvJyBBJ1UVjyB0owpYkOts0Qv/ThhRB4upn0gv97E=; b=qBh7622Xz/PlGJrTGdd9Ln0FsLiZWGs0sfx5FtNKpIJ+TXRIyB6lE1xjiv4LIZqFmK 4UX6EcBjeQFTtceoChQwcrXmGidhk7SpeM3sRk0lFLbaHm+/Ro/194Ue5nswH/J7aUel yqbHCzmvschffBDR43lUxmYDYoByRSWqCpqjiWCposf6Vau1pQPGgYI1xFHBYVf5lgf/ sW0CKjTx729cUAKltTE3mPObjSRLp+BfpZaadV7xKgONJpvl+IiD2gQHsCZUZjKLjEG1 A0fnCNYw+E9Gq6xsyGkqmNJh2ORUxdGB2ZRnTh0OizGiKHCs6UJ5Fcb6R6FrfuOoyBjI 2tZA== X-Gm-Message-State: AOAM532igTCbzGDYlcDPN6YBmAxnnURn7Jr8CZTNKpleAhEdZoNASNDY C2cgOjh3iAWfFTtlNQCrjJSS7J5cCh/csg== X-Google-Smtp-Source: ABdhPJwp7ojg3WtKXosIUc+qZlAulzztC8LQiBuxORtiKgd/PNWaLaL0FdsVufDmN9NGuB0CT1OpdA== X-Received: by 2002:ac2:511a:: with SMTP id q26mr1954804lfb.399.1619167622137; Fri, 23 Apr 2021 01:47:02 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id w1sm487391lfq.53.2021.04.23.01.47.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Apr 2021 01:47:01 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id q22so13916638lfu.8 for ; Fri, 23 Apr 2021 01:47:01 -0700 (PDT) X-Received: by 2002:a05:6512:139e:: with SMTP id p30mr1985095lfa.489.1619167621014; Fri, 23 Apr 2021 01:47:01 -0700 (PDT) MIME-Version: 1.0 References: <40116716-D8D9-438D-A168-B26A112D199E@yahoo.com> <445774BD-D68B-48A1-856D-F8DC9A480C68@yahoo.com> <0C66B2A2-C9C6-4783-8A26-F736F3B9CCD8@yahoo.com> In-Reply-To: From: Gleb Popov Date: Fri, 23 Apr 2021 11:46:33 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ? To: Mark Millard Cc: freebsd-hackers X-Rspamd-Queue-Id: 4FRSZx58LGz3tH7 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of 6yearold@gmail.com designates 209.85.167.49 as permitted sender) smtp.mailfrom=6yearold@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[yahoo.com]; FORGED_SENDER(0.30)[arrowd@freebsd.org,6yearold@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.167.49:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[arrowd@freebsd.org,6yearold@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.167.49:from:127.0.2.255]; SUBJECT_ENDS_QUESTION(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.49:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.49:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 08:47:10 -0000 On Thu, Apr 22, 2021 at 11:59 PM Mark Millard wrote: > So s2 gets the pid of the ncat and s gets the pid of a.out. > > Is that what you expected? > <...> > So s2 gets the pid of the nc and s gets the pid of a.out. > > Same question applies. > <...> > Were you expecting s2 to get the pid of nc and > s to get the pid of a.out under FreeBSD as well? > Would that be getting what you want? > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > > Most probably, yes. I'm not 100% as I'm still trying to reach authors of https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L811 and ask them what this code does. On one hand, [1] hints that creds for the listening socket should indeed match the user that started the program. On the other hand, log message at [2] looks like they think that creds contain credentials of the connected user. Like, the authors also mistaken the listening socket with an accepted one. I'm confused by this and keep asking on Collabora IRC and forums, but didn't get an answer yet. [1]: https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L833 [2]: https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L844