From nobody Fri Jun 17 19:41:17 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99AE985D9DD; Fri, 17 Jun 2022 19:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPqCy1nc7z3jJF; Fri, 17 Jun 2022 19:41:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E5PHBcKPbS1v9MgY+J0ljc6eEZjBlWlhmAvWw1f8Myk=; b=B2rl3N3oOoZ9O03hTN2XbgggMJoy71RbEHfTCLsCCKko64D6hUB1kFW/+AQxXPfZSM2VfC qRsTaMuh4WZ2g/JSFb4x6wDDXkEk86Sqrcd1kisJjlMZ4jWSw+aXmFA3EthiVsDkiMrp9r MYmm80mw0RRZ88xQf4KT4LKK0dqFpn8oHyBc3zFTnpUP318glCofpvznlwSe246JpA0PC5 kKXsqYTeb7Dj+3P63yUhyglmI4O78c4Kjm2apKrk3yWpb7RFujg/XWQMis3B9e4rDWUHTZ XRWEdMwByRixQPMNpIZll7yQ7y4VKEgDJjKsHvQvNLNt93WHS/vhIgWiHPgaqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E07F425C75; Fri, 17 Jun 2022 19:41:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJfHaU030287; Fri, 17 Jun 2022 19:41:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJfHxS030286; Fri, 17 Jun 2022 19:41:17 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:41:17 GMT Message-Id: <202206171941.25HJfHxS030286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 44c89ec74d0a - stable/13 - linux(4): Overwrite SO_TIMESTAMP counterpart List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 44c89ec74d0aefe8402a12fcc687536ae9dca61a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E5PHBcKPbS1v9MgY+J0ljc6eEZjBlWlhmAvWw1f8Myk=; b=s7c0hwaK8ZSHAHLvg39JQjGHwK0VmsObbPPO8XLEasTBSw4hS+aWeGwUWfRZHc0mpiHmr3 DXkyEExzKpG1fyUZ/GRTK4y1lnQc7LrWYZxTa7FIiZjFJIt3EDXrj8GeIIvX1WbGSWhs0j if5IukthpA6JBMffNUOMIpI5lLHIL03T75DvCb8Ufk2Vb6VhvUPZoY7fDDsfN8Q6TAWjag 45MXhr2BUJUAyATAnSB9UxVYnQBLPtD7jOy07z95rpnmz9bvvA5L6xk1i4YZJfPJqLO0Qk RhD7OLN2NxpahWIrHGN9Tmw/ZK5npbhAsKBj6IOeJC9pe0frlatOnYbTxgcadQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494878; a=rsa-sha256; cv=none; b=LNQd9bAtRxS8T34iTKybUQrlZoy018AB52Qhzg911GhR9pmAcUWDRdOgjmpMDmNtlR5LKc czjxPSnxWeG2PNLKwVQaKcLXVj/31Kn80jfVFF57ZqN+ccL+pKe6cIaVzrHeL8CHGB9Qxm +i7/MuQUwHfULNoIVwK6NhoPDJE2n/Zamp/OF6huEB96JLF+oW2JYyeQkA00rBt/grN1Gb nqzdknsxQ/b1VMIl3u+CdFj/fYk6YCv0kKPLhcfhXHQXPTDLHgr0+5rUe2Wze5GHo2pztf pM3XJlSuDyMW//BOvTzcAHshMQDfJh1an46JIxlsKEQOmrR/nEfv+s4sRtuHkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=44c89ec74d0aefe8402a12fcc687536ae9dca61a commit 44c89ec74d0aefe8402a12fcc687536ae9dca61a Author: Dmitry Chagin AuthorDate: 2022-05-28 20:46:38 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:35:35 +0000 linux(4): Overwrite SO_TIMESTAMP counterpart A socket cannot mix SO_TIMESTAMP and SO_TIMESTAMPNS: the two modes are mutually exclusive. MFC after: 2 weeks (cherry picked from commit 53494b918d63a5b31793ce7f66569d4bd03f5817) --- sys/compat/linux/linux_socket.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 401e1bc5c88f..3fea532d676d 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1984,7 +1984,7 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) struct sockaddr *sa; struct timeval tv; socklen_t len; - int error, level, name; + int error, level, name, val; level = linux_to_bsd_sockopt_level(args->level); switch (level) { @@ -2007,10 +2007,22 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) name, &tv, UIO_SYSSPACE, sizeof(tv))); /* NOTREACHED */ case SO_TIMESTAMP: + /* overwrite SO_BINTIME */ + val = 0; + error = kern_setsockopt(td, args->s, level, + SO_BINTIME, &val, UIO_SYSSPACE, sizeof(val)); + if (error != 0) + return (error); pem = pem_find(p); pem->so_timestamp = args->optname; break; case SO_BINTIME: + /* overwrite SO_TIMESTAMP */ + val = 0; + error = kern_setsockopt(td, args->s, level, + SO_TIMESTAMP, &val, UIO_SYSSPACE, sizeof(val)); + if (error != 0) + return (error); pem = pem_find(p); pem->so_timestampns = args->optname; break;