Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp264522pxb; Sat, 18 Sep 2021 02:09:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI2TnGvwhUL98mO8NZfReZa6Hc7l6hAbn2VTW8UbalXLIvjnla23fgaarPkE7HTHJxjAPi X-Received: by 2002:a05:6602:584:: with SMTP id v4mr11894087iox.85.1631956142791; Sat, 18 Sep 2021 02:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631956142; cv=none; d=google.com; s=arc-20160816; b=LDiStXaPs5R0vdWfXPJ6Xwj6hZ+h3zfyIj/5TmK7BNNHxCFJHNwiw8paeivP/Tjaav oowOD7/0FLR7o0ak/sP9SYf+bQGKW2cgh7Y5WRQtNpNWcXPJqYmMwL1Aom75PFDaoxm4 yVLz3SLsVirB6pT3q6Sr7liiZ1Vi6Tk19yjhHgnUz5juIaVtgusCbEnTGPvkROIgyrJw 9O1Yo2eomwmoFbMg7eypkiwAdcm63m+QdLVcy+4jlzPb3Mi3gWIxE5oIYQp4mW4McnzN /pWEcVkZ/CMG/6+6H5frLYX9LTDaOH6d12gZ9/zeRQbf2pFa19C1ZK/GLytsO8++vrsM Ding== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:to :content-language:user-agent:mime-version:date:message-id; bh=N7xe1MVTQpkG9cEW7D9KE/1zftBQkfOXG7Edz9i11jo=; b=nr8wOQ0LyzYHGvrBliDl2tkMOQVtRQgWzi5/PtrfUlVdw5sdHAzTs+uui6hnPSj32K /M9KxZtBKRHK1AhOdICB16zCoS/BwF8cKMY4JZMhT9ET46H6gu2iEX77m/3BmX7gomXr Mszo1JwuHuSl+zcZUbzUiXPO6j+wKbVsn+QzVbHSJqxogNC8URvq5JUouBVCVqCj64tm WApculjZqMQyAwHpgIILsLnGCDP00hMLv9VwJg5sW650S/oq9s+HyB5Y48JTIhVMeuYD n7eo7fCA665bbD5EgElYkFNjR3ckms8P2ucvf9biZsp1mkjWsMEbABHTze0zwGMP4lEJ 07uw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l126si7557374ioa.77.2021.09.18.02.08.34; Sat, 18 Sep 2021 02:09:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244281AbhIQUIt (ORCPT + 99 others); Fri, 17 Sep 2021 16:08:49 -0400 Received: from mail-lf1-f48.google.com ([209.85.167.48]:33439 "EHLO mail-lf1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235575AbhIQUIs (ORCPT ); Fri, 17 Sep 2021 16:08:48 -0400 Received: by mail-lf1-f48.google.com with SMTP id y28so36642795lfb.0 for ; Fri, 17 Sep 2021 13:07:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:content-transfer-encoding; bh=N7xe1MVTQpkG9cEW7D9KE/1zftBQkfOXG7Edz9i11jo=; b=s4glgaEvBEqj9gRyr/WW9U6X32CMUbCUp0aLoZv1j+lm9S1SYrYuHd0giBFAWR9MFZ 1FEBlzNZm5U1HjeznqHC3Ahs1bfTAttYv9igsUYzTbTuf3T6IgNI6tUsvsz43ulDJbo5 v0hDrjW9A88AKASwa6GsGuuxkhlu/9audbYX67WrbThK64/gfRD5kHdfLw9NfuXrv7RP m9HDk1lBStDA0zCK+eMSQFQXJ0Bp21n45GGGJcULuIo+wI0ze9dgwpnh4O2z1PpMf3oV CyUtkHQMA3Vgh2zJI2s2rwiceAAego2JfrnAiixA3eizv3ZpIHIBFq7v41o4oPAgMP4p cDFA== X-Gm-Message-State: AOAM533FeMJROqyzgvm2SiDSEQ6rTe4pedHFEKE6SQPr7zJnyQ3Olc0T h62ZWnuadD9guy99LoT/b7uutF+kSC8= X-Received: by 2002:a2e:6a03:: with SMTP id f3mr10754662ljc.487.1631909244576; Fri, 17 Sep 2021 13:07:24 -0700 (PDT) Received: from [10.68.32.40] (broadband-109-173-81-86.ip.moscow.rt.ru. [109.173.81.86]) by smtp.gmail.com with ESMTPSA id f4sm600456lfr.151.2021.09.17.13.07.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Sep 2021 13:07:24 -0700 (PDT) Message-ID: Date: Fri, 17 Sep 2021 23:07:22 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Content-Language: en-US To: Linux-kernel , Peter Zijlstra , Josh Poimboeuf , Jason Baron From: Denis Efremov Subject: Unloading a module with a function which is used by a static call Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm not sure, but is it intentional that we don't increase a module refcounter when we call static_call_update()? Let's imagine that: we load "Module A" with: void fire_a(...) {...} DEFINE_STATIC_CALL(fire, fire_a); EXPORT_STATIC_CALL_GPL(fire); static_call(fire)(); // from time-to-time and load "Module B" that: void fire_b(...) {...} static_call_update(fire, &fire_b); and then unload "Module B" without updating back "fire" to "fire_a". "Module A" will try to call "fire_b" and will crash the kernel or call something else instead. Maybe pointing static call to a default value in static_call_del_module() with a WARN can be used instead of module_get(). I reproduced this scenario here: https://github.com/evdenis/static_calls_unload_test Regards, Denis Efremov