Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2514042pxb; Tue, 23 Feb 2021 08:46:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1L3HSuOBxYREkCu/KQTr1bsS+Kq0yGySqdIeWHLI8E+evQxjz2V1NiraOvevtwWbhmG1t X-Received: by 2002:a17:906:4102:: with SMTP id j2mr18170461ejk.460.1614098813888; Tue, 23 Feb 2021 08:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614098813; cv=none; d=google.com; s=arc-20160816; b=V1wV/1E5KLOk5VGouZ+VzR3P9a6rg2EZnoOsfGdoBvtY0fYNfw4qwsn4fkLKcpxrgf lzh4WQbt0W8HAztKBI2+E3LE4+0rx8fhor3tQWQmZjxqlxlNBeyU0O/6V/CteIWoSg0S rwdT52B0acIr4/5xE8YRYZP0jiSVWrw3ZFXhwlc8WeFTuQjR2sFgIJkg0bFCYkZAhn0b 9lyo0HLbIaz/Md2mSAnAUnjP2DchwgOgrVcR1DfMrBJaeRzcXqPtVNEsJ+qZbvH17n77 wC+TsE/VgD4c4mrSaai5Wtaq+oRULWqivJHdjEN/IrG0Qfy5UTP5jNCLgH4zFcVuGmaF uFgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pmPfSnwb9WVL3HWBYOU43s+aaTja6BAXtWKSK5U9rZk=; b=FxnrbDlezw1VDg39Njl+KDb/5Nj1OiLcIyTs8Cvy/Bfv08dk0UvOCovk1/av0ajhkL 1xDEqUm1sxVfKoyXOwQWlTeBJuzJdvC3ekqUykVA02bSsJcvfkzzDS9w9IwyR7GceE8i 4e7GGgGwYetnPLZCCUCSgaJEzs+VWFUTaLw0VFFUsjlDu2PkfDJnZ3HpV1CiVBwtEwjz LzT4d6mBurg2kB9W3Q2ge3mOD3hhN6/lxkTdfyWCndlvi7b6URY1PNrVQdCItJocXat4 GYiw+JZTDgHoBQMDWkhOoV86GMo7M7NdjRjnenhrlpyQYKP2VHHfzkaf46e8p3PlDPzN i3hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DYBn/AWB"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si15675152edd.574.2021.02.23.08.46.19; Tue, 23 Feb 2021 08:46:53 -0800 (PST) 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=@linaro.org header.s=google header.b="DYBn/AWB"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233490AbhBWQmX (ORCPT + 99 others); Tue, 23 Feb 2021 11:42:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233423AbhBWQmV (ORCPT ); Tue, 23 Feb 2021 11:42:21 -0500 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EFA4C061786 for ; Tue, 23 Feb 2021 08:41:40 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id u20so17765489iot.9 for ; Tue, 23 Feb 2021 08:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pmPfSnwb9WVL3HWBYOU43s+aaTja6BAXtWKSK5U9rZk=; b=DYBn/AWB8IOwn86jhiwxaefJTaFpiOI8uu8fUG2/mG2HudIzd3AU1KFaB41PLWCMMx kSQMe9CtkmbmFhBHQj/ELY92QI981kY+wcJcs7eOZl8ju9pdyilct4125awQUU8uZOpk 8bkqpiRhZeiTyWwY3kdLFhHQEdTj22aMthsGr5k0jALyChQZEqLjaWewXHQgUsjnmiDk OH2QJh/c72QXHPkr/EEJOMLkb58Yruoj3H/57OOvkjlCIBbkINR+s/+3EFd905WzyXJl q4OI0IeOCSwsgIgLsyeMWqE+nDVh3ePcbn2NVGRSCHATkKVIWI04Mw3zQ6LtkbDQYvto Sq3w== 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=pmPfSnwb9WVL3HWBYOU43s+aaTja6BAXtWKSK5U9rZk=; b=Rpz7y/+hLI5qJA2AsT9F9f72z6Rs+nKJdjls+5ozScPgK4ETpMa8CrKjFeeYYXRn2q /z8r42BOrnXIV7n5VyeqTFYeYfm4kzYXWevM9G8cDVM+ZF5dkgssoeb5zmc49yfB7vUn 1yR4h74dGk9AcJRJiFXjPUQalP4678o5L/ioFEp97TyJHeYaG2n/3jPtv7FQCBV7hamm 9U2UVHyhZjfVFyjvC5C8ciMIr9oyxEuKFHh0SvtwiGnVhHB4z7XcWoslo+kHHL5i7gE8 tzNMEWXFVjOclujfWXhgYvC13fBlktHIKkV3HwT9oPagPzXa/fstJbrTfmcXu9M47iqE PQ3A== X-Gm-Message-State: AOAM533aV3zCiqy9dwLNQyqAYO67uX7V0mLNgwwWY4D7A2gqXWcRU8ix oab54aKWVT8LxdUMcxSJc7Z31ayS+xNLLsrm/hqaRA== X-Received: by 2002:a05:6638:1390:: with SMTP id w16mr493408jad.83.1614098499898; Tue, 23 Feb 2021 08:41:39 -0800 (PST) MIME-Version: 1.0 References: <20210222072217.15633-1-jindong.yue@nxp.com> In-Reply-To: From: Mathieu Poirier Date: Tue, 23 Feb 2021 09:41:28 -0700 Message-ID: Subject: Re: [PATCH] remoteproc: core: Remove casting to rproc_handle_resource_t To: Sami Tolvanen Cc: Jindong Yue , Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc , Peng Fan , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Feb 2021 at 15:48, Sami Tolvanen wrote: > > Hi, > > On Sun, Feb 21, 2021 at 11:18 PM Jindong Yue wrote: > > > > There are four different callback functions that are used for the > > rproc_handle_resource_t callback that all have different second > > parameter types. > > > > rproc_handle_vdev -> struct fw_rsc_vdev > > rproc_handle_trace -> struct fw_rsc_trace > > rproc_handle_devmem -> struct fw_rsc_devmem > > rproc_handle_carveout -> struct fw_rsc_carveout > > > > These callbacks are cast to rproc_handle_resource_t so that there is no > > error about incompatible pointer types. Unfortunately, this is a control > > flow integrity violation, which verifies that the callback function's > > types match the prototypes exactly before jumping. > > Thank you for sending the patch! It might be worth noting that Clang's > Control-Flow Integrity checking is currently used only in Android > kernels, so while the type mismatches are real and should be fixed, > they don't result in runtime errors without this feature. > > > To fix this, change the second parameter of all functions to void * and > > use a local variable with the correct type so that everything works > > properly. With this, we can remove casting to rproc_handle_resource_t > > for these functions. > > > > Signed-off-by: Jindong Yue > > Reviewed-by: Peng Fan > > This looks correct to me. Please feel free to add: > > Reviewed-by: Sami Tolvanen Where is the original patch? I can't find it on the linux-remoteproc and linux-kernel mailing lists. > > Sami