Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2449505pxa; Fri, 7 Aug 2020 11:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVjjFe/Fyvr6Sv2hL9fxRJ1gErXxfaIeViJhDpI0R692qmV3nxMALiEwj9v5PQiMnkjikN X-Received: by 2002:aa7:d45a:: with SMTP id q26mr9774433edr.95.1596824538279; Fri, 07 Aug 2020 11:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596824538; cv=none; d=google.com; s=arc-20160816; b=d/MPUsN8UBtpV8Qe8pYYjiNMvKAdPuFjVGLgQspud4eLO7b891nK8sy/QxAaZfS0qx UzROV8oOZWo5cxAkFWUPJEgMGL3p187EdZm1VWA+CF79KFxQyWXg4IJt++R5PHK3NWCY G5Tvf61S9YyG3a+wYJAaRgUh8huSmgMIxMz/NnxixB4yDTvrdYw++Wt8jLfFmYa4d+Bj GY+K6xLkBgDEyFH+qF7J8hSjFE6kLgS+pVLFKCtcaw8n7Vw0NzDOBztZ6HPaxkma8CEk URdGhcUgmeYrtJBpgjvKzbNkunTW9ILbzyY5Qj7iRIEco6zCRtPq/WrcZFuh0JbyZFj7 HzaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=276xfBP1w7X97C9ql/giGHZq7wUWHu7gA5RsgQzdGD8=; b=HYLRipJyrVTJSGJ9gmgjsCPcVUh0vNP5uKgCz6ap8a7iEPjwaAklaouJ16gan16aUe 30Kz8kpUh24OzYFkrkQKWKvec7d2RH17VOZdzImiyaAHhBRfx800tguJwkhy1w2M75JH hgZ36JQQ4vlrvTGZ3yhqs/sfQm7u9W18B5k5kh9jTSwFGVl6W1xW3iZqDPjlwt1MvrkG oMTOgZHNBV06Zlv3mmCBmOpA6xCyQyjMhdIMo9H0GSdHMGGOnZfxAWoZJRs31nwOj457 e/iwLkkti/VEhMGGzPdEZLrwk7SGiivYNV5DtsbRGuL9OtzmI7do5TocjTwGk7sVRiim kl5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CfIq8Di8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si1296892ejf.672.2020.08.07.11.21.54; Fri, 07 Aug 2020 11:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CfIq8Di8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbgHGSUI (ORCPT + 99 others); Fri, 7 Aug 2020 14:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbgHGSUI (ORCPT ); Fri, 7 Aug 2020 14:20:08 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C52C061756 for ; Fri, 7 Aug 2020 11:20:07 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id u10so1445525plr.7 for ; Fri, 07 Aug 2020 11:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=276xfBP1w7X97C9ql/giGHZq7wUWHu7gA5RsgQzdGD8=; b=CfIq8Di81sNR8H7lxHvtX5Wf9ujf7h2Z7Zl4RVbivy14BVenOOwEPCAOK2JLDNqRTx nHM/sU8R++Rl6OIie/IdyzfRA4ubxnpKdEh3KeWN3g/reUqromIvaNVBw87crAMwI7SY GBxKuPPM631RqGadSnzlHL+58VV1RsXfsvLIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=276xfBP1w7X97C9ql/giGHZq7wUWHu7gA5RsgQzdGD8=; b=E/tVxi1eljMmdtf06xT7/95t+hwd412ay1jLkL7gbHh1e2kVrBRkewDm82BCsCN6pI aOtGgK0NT7Tbz4dwvGJb5eRFQYzEJ6d/JgZ9SdOmbc5U/U9G/1GrB/zx3qxmz3uClFS+ FzBERo60n10Ifg3c8zPgPvi9+h1rRNqqW+lPN6YqzOyELjFwNUyFBNtXpyDklhOK41KA ckgW9wTEGJR9ItcNGj2tqgpbNE8QvjZoLvKoNj/Zkbmsuoo5MBXjrUH8oZuooBec8JKe KfoMAiasuPZyv60WFeB+bYeSdhuLh1/658NO+19usU7meqmOszpRNttlirhgxiBe2qqA 2MKA== X-Gm-Message-State: AOAM532J1nuG6vW2lov3DDh619WNGnKQXl4AyhGJNbq2kJ+HXo48n+RK Bba74WiAZdWJGcE1ZdsuwlJoNg== X-Received: by 2002:a17:902:b407:: with SMTP id x7mr13504740plr.244.1596824407469; Fri, 07 Aug 2020 11:20:07 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z25sm13723421pfg.150.2020.08.07.11.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 11:20:06 -0700 (PDT) Date: Fri, 7 Aug 2020 11:20:05 -0700 From: Kees Cook To: Christian Zigotzky , "Alex Xu (Hello71)" Cc: Thadeu Lima de Souza Cascardo , Linus Torvalds , Aleksa Sarai , Chris Palmer , Christian Brauner , Christoph Hellwig , Matt Denton , Robert Sesek , Sargun Dhillon , Shuah Khan , Tycho Andersen , Will Deacon , Will Drewry , Yonghong Song , linux-kernel@vger.kernel.org Subject: [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring Message-ID: <202008071117.56ADE58@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When refactoring the SCM_RIGHTS code, I accidentally mis-merged my native/compat diffs, which entirely broke using SCM_RIGHTS in compat mode. Use the correct helper. Reported-by: Christian Zigotzky Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html Reported-by: "Alex Xu (Hello71)" Link: https://lore.kernel.org/lkml/1596812929.lz7fuo8r2w.none@localhost/ Suggested-by: Thadeu Lima de Souza Cascardo Fixes: c0029de50982 ("net/scm: Regularize compat handling of scm_detach_fds()") Signed-off-by: Kees Cook --- net/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/compat.c b/net/compat.c index 703acb51c698..95ce707a30a3 100644 --- a/net/compat.c +++ b/net/compat.c @@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm) (struct compat_cmsghdr __user *)msg->msg_control; unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0; int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count); - int __user *cmsg_data = CMSG_USER_DATA(cm); + int __user *cmsg_data = CMSG_COMPAT_DATA(cm); int err = 0, i; for (i = 0; i < fdmax; i++) { -- 2.25.1 -- Kees Cook