Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3449981pxb; Mon, 4 Apr 2022 17:21:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZZjW7cW3C/65hN3qRhaZu03w7xP2cfwTr7vnJmZpk88RDs11asIuSvDQVs02lLahQuW8j X-Received: by 2002:a17:902:a501:b0:153:f956:29f0 with SMTP id s1-20020a170902a50100b00153f95629f0mr821123plq.120.1649118079073; Mon, 04 Apr 2022 17:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118079; cv=none; d=google.com; s=arc-20160816; b=AmYjnWT9SCA8pgdS6vZMKsyTMLi0QilTZdRDccHoD26sJf7QCCRz1E+o+HM2M6UPDr Vz29n8k/uJJvO2W1QmW46FHuxN4twIZtg1Ps+DungrKp3DSHpwhwuoxIOH6uVD+DwN52 /I8qg9zfoUo1BClv9m1f1H4rRGaWYZYJiMCywu7vxGdeuJZWBQZMC7V3D8fTfPd1QHM2 4afUH4Qz6BP/RZQ8nWxspQgmPHmN3lwtFBhXVvt6YrnbzqE3Wa4xbzagAhDBJrot0QuL 81R5m/cV8wL9giqJ78+V8G4JSicyP/mcM0dAIu0Ts3IFkLuJ3za2Kmwwxtkj9dAv6BG9 6a7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mr7YWSWf9Fh5mx8DlwJhg4GGJWPL19lC/MOxR2q8iLM=; b=ljpbPMYO5BoGeGyulrtyYayaRwNts21B50JeLvX2TXhNd1PNptQT07eZuEw+96O2kp gl1D+zmPi+AeES8cesCF7NuM/0oHevOMOUMdz4qq24ZqOHp79Y/EQrqn+6a2tAnbG3Np JmJg9nadvW2exg/iT35zDbeIkhdKN39KOwnZHxP2WbH7MVcB/hHbPDZQn9/LTdBdXd9t cZgOfJwdVEOs+UbVThBxoW5Fknk1PFht4JgI/kA3G8Q1FdfUHsTufHjzJ47usRp0+UJi c6morBra96XlbU4kAxFA3EQRW+4gDXj5bqRxhG08JW1BIiZn/ZwfsylYzy29lVNRqkyL gnhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AtCNH6+q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h1-20020a17090acf0100b001ca35559ee4si625981pju.21.2022.04.04.17.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:21:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AtCNH6+q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FE8413D5F; Mon, 4 Apr 2022 16:46:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378164AbiDDOuj (ORCPT + 99 others); Mon, 4 Apr 2022 10:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378405AbiDDOuG (ORCPT ); Mon, 4 Apr 2022 10:50:06 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 511F317AA0 for ; Mon, 4 Apr 2022 07:47:28 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id n6so6410369ejc.13 for ; Mon, 04 Apr 2022 07:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mr7YWSWf9Fh5mx8DlwJhg4GGJWPL19lC/MOxR2q8iLM=; b=AtCNH6+qLl12Ug6eCiCqNuePjAcTpoPNw1iCqIx/6BeEJkZKJ2r2A/FwRnkTXyC5rM lEsG+RwBEkuX1fb0w9jo5BomEak7mLveAThWEODoGMM1NHmEzFFyp18MxsbXGJqc9Vbs NVAFME0UufgcpbPEmQFiab7xuRREsfnh6IBCCZYFMKcwZ7lFo9zVXVS5Q3j21wjC3N5N EJ6SGJPRm9VXBc0nuTZyOT8Vuus+vrgIzw6aNHweHSai15ka2cnDZT4S0IBIB1BtEq0U vQL/AgqEg0xNQXcFoG9kNf5xXl11+FhW4gVmdMBJO4KcON+QL+dJV7cAjDNxiL1WvuI1 N/vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mr7YWSWf9Fh5mx8DlwJhg4GGJWPL19lC/MOxR2q8iLM=; b=FYwmy48wlva1ETNnExUM/78QOkp9cd7vEY6Z79dlv17THE4z5cR0WnfX/hSck5xFB1 UTZZnW2Docc3q8htTazYnUcHnJUAPulmVcztLo0ChddvpIMrfQQajex8pr8Q2uUb0AKb ZFxv89HoHZFulYoO1XfdHX2mAgfRCHHEd7IvzTmMruHcHUNEVO6mXC652tBiWcmspYeR LcC19izHBdqwRo7KfLZXnFtzlHNFhi6J5gw1p9leqfAkrmgIoCvgbcqdpB6O7NQshIHM MOFVC89iwSmrhnnjGOn4gpx7w8KAXEAnB6yBQaRMUpxsHupiykbPg2ipld/dEOqmQxze QLxg== X-Gm-Message-State: AOAM530Ua4WEJTJVTbO9TPc/N8GtU1K0ZqtoNbdwlNdXlLB6YQ/RiF7H 9n237RRjiXIas70j31C/Bb0= X-Received: by 2002:a17:906:3283:b0:6ce:78f9:fafd with SMTP id 3-20020a170906328300b006ce78f9fafdmr431125ejw.534.1649083646445; Mon, 04 Apr 2022 07:47:26 -0700 (PDT) Received: from leap.localnet (host-95-249-145-232.retail.telecomitalia.it. [95.249.145.232]) by smtp.gmail.com with ESMTPSA id gn3-20020a1709070d0300b006e1036666bfsm4409656ejc.223.2022.04.04.07.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 07:47:25 -0700 (PDT) From: "Fabio M. De Francesco" To: Dan Carpenter Cc: Charlie Sands , gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net, phil@philpotter.co.uk, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, paskripkin@gmail.com Subject: Re: [PATCH V2] Fix unsafe memory access by memcmp Date: Mon, 04 Apr 2022 16:47:24 +0200 Message-ID: <1723480.VLH7GnMWUR@leap> In-Reply-To: <20220404143531.GE3293@kadam> References: <1890716.PYKUYFuaPT@leap> <20220404143531.GE3293@kadam> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On luned? 4 aprile 2022 16:35:31 CEST Dan Carpenter wrote: > On Mon, Apr 04, 2022 at 04:29:48PM +0200, Fabio M. De Francesco wrote: > > Is it safe to access user space pointers without using proper helpers? > > No. > > > In those cases I mean: is it safe without using copy_from_user()? > > Correct. You need to use copy_from_user(). > > > > > As I said, perhaps I'm overlooking something. However my conclusions > > follow by your own argument. > > > > If I understand what you wrote, you asked to delete rtw_p2p_get() > > because it looks like nobody "has ever tested or used this code". > > > > rtw_p2p_get2() and rtw_p2p_set() use the same pattern of rtw_p2p_get() > > when they access user space without using the proper helpers. > > Those functions use "extra" which is a kernel pointer. Which user > pointer do they use? Sparse doesn't detect it. You're right, sorry. This is what I had overlooked. I took a brief look (just 5 seconds or something) and saw the same arguments that rtw_p2p_get() takes and then a long list of calls to memcmp(). I overlooked that they were called using the 4th argument ("extra"). Sorry for the noise. Fabio