Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2895082pxk; Tue, 15 Sep 2020 05:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0DmOXQ3c2bKp2dvhs4NdCu5AiXAc0GfuM5ZVTEdo+46BfsOkCd9qXvrHImytnzhfYEj/E X-Received: by 2002:a17:906:e103:: with SMTP id gj3mr19431521ejb.153.1600172470212; Tue, 15 Sep 2020 05:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600172470; cv=none; d=google.com; s=arc-20160816; b=o3aGd3D2s9fz0y/fBOtJQlfY3wBDEIdadSNV+eBiXaUUF7ta/6H0Rd5spudT98hQ+T PuladgJ7oONWQphdVIBm0Sjtnb8EC9GI4flqAliGAMgByLnlvob52MOFhkurV10CX34L VBk5CC2Uar7Df/ydG7ht212MIUWHSX9YxnDmlVts7LTmGR0qYLyVwHjhcnaD7dWdJC0I EnhvCALW7fVJr3mcbxpcRv16R0nhI0VIFcjqjahbyqUFK2zogRVEwqsD3ODxhNxjboRL tSn1X8Yu4XYT8e/NXHStnfjDzNI09pKHpyBSyHF/piTkauTKX/VQaeYVUbAhdjkfj1FC mIEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2ZJ+GbXc0wmHPJm25O4vi0yPUnebJyibV4Y+lWCt0+0=; b=Mg9oa4OpPf5NJwnhgp3smQ5cCrxFslB/sxC2yTrbXae/j1WN/mMA+IjcFl3je7Hdvf apcxvZ1Msn0GHq5Yh+kFHN90aihrwihcHmDUqJABBYXAUSHqPOB1vSjgMU498siBYg/J 51O1xdBnDK/qLwepDw7779a1TEpVg6JQziS1CkUGm4h5X5AiZ/lDZ4vBsvVdEiahstHr qQMlnAR458c8egSm+ZoPaD9A0pumJb+FW6o05fAulWUjO7zxOhWuOnjGRLWu+sFSgQF4 YkRwZRbRii6+7l8eP5AVm3J587tWA4EYBpbTrhUqhfyUNZ6yr4NKgN9VikVJBw6dgTuI JEYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ACGjOsqY; 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 l21si9652348ejg.119.2020.09.15.05.20.46; Tue, 15 Sep 2020 05:21:10 -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=@linaro.org header.s=google header.b=ACGjOsqY; 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 S1726178AbgIOMTv (ORCPT + 99 others); Tue, 15 Sep 2020 08:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbgIOMCK (ORCPT ); Tue, 15 Sep 2020 08:02:10 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805B6C061353 for ; Tue, 15 Sep 2020 05:02:09 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id y17so2786004lfa.8 for ; Tue, 15 Sep 2020 05:02:09 -0700 (PDT) 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=2ZJ+GbXc0wmHPJm25O4vi0yPUnebJyibV4Y+lWCt0+0=; b=ACGjOsqYMP3W+ZFb5of5vpmVTwBuG62LZrzZaBFgNeYvwqO859mMvZBEYQiJIgQgNb UPrbR/VK1ho4Pnoer/NfYREwCfGFQtHrdCs7uLG6InbMc8W/ZhU76BwGSLYnG7IduY61 FK6Sdakr0Z8ueBxFakucZIQBNwyl72BWcJM734s4RFvGRiqURtUZHHbR6LjHQFePAskz HvX2V7eNWpVfrgf914kqkLO/rL1slXoieGLMb32oCzx8iGNLfnE9q9ZH0EpJxxNRKf8o Cnm9EJ32p7menxU82yE728RbVvNkzfOqguU5VibAzR4XnpueMNlDGXdyEpF20f4LP/yK W7Bw== 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=2ZJ+GbXc0wmHPJm25O4vi0yPUnebJyibV4Y+lWCt0+0=; b=hBkgZC6/fl53f5UA4Wer/dqW3lktKm5Q+E81PuViOsaMU1a2j3gb3HSrpwFTwCI+85 qE08bTOuR+B7glfHIwh2cGQF1IrF/IYawPnA1TC8vPNE3Bnr5pJiznkBSIOKJ5tH8IBN yZwujnoUHVBUELXiUoIhOzyllbwpYz3mY5ZZKKh6TlNCXKHPL3JmNZ2Fdnrgk+tOTxVQ CvBF3VZF1Y77kcMY0P3hIRnKDuVrRh52xQ1iTsmuSdexOIfGLX8q3QFxy/7S0uf+Vy1e vk9WBInpYQ5xVVDuAR3JZUSMlrP3q8zj9nxslitx+BooCIvsIhjjyZQ9lLwtYNNA+znO Qa3A== X-Gm-Message-State: AOAM532aE2l0bhSG7YbNCEdAjlFmTvlF1/J5WbVxLE/B3LOWi4DoiYNQ 5Z7vXtQsKZ1uvH2FczV7ixLTMheYj73nqjwroXC1cA== X-Received: by 2002:ac2:54b4:: with SMTP id w20mr6963969lfk.13.1600171327699; Tue, 15 Sep 2020 05:02:07 -0700 (PDT) MIME-Version: 1.0 References: <20200908125813.8809-1-brgl@bgdev.pl> In-Reply-To: <20200908125813.8809-1-brgl@bgdev.pl> From: Anders Roxell Date: Tue, 15 Sep 2020 14:01:56 +0200 Message-ID: Subject: Re: [PATCH 0/3] gpiolib: generalize GPIO line names property To: Bartosz Golaszewski Cc: Linus Walleij , Mika Westerberg , Andy Shevchenko , Kent Gibson , Greg Kroah-Hartman , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-acpi@vger.kernel.org, Bartosz Golaszewski , lkft-triage@lists.linaro.org, Linux-Next Mailing List , Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Sep 2020 at 18:40, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > I initially sent this as part of the gpio-mockup overhaul but since > these patches are indepentent and the work on gpio-mockup may become > more complicated - I'm sending these separately. > > The only change is adding additional property helpers to count strings > in array. > > Bartosz Golaszewski (3): > device: property: add helpers to count items in string arrays > gpiolib: generalize devprop_gpiochip_set_names() for device properties > gpiolib: unexport devprop_gpiochip_set_names() I do an arm64 allmodconfig build fron linux-next (tag: next-20200915) and run that in qemu. When I run I see the following output (see full log [1]): "BUG: KASAN: null-ptr-deref in device_property_read_string_array". [ 6186.339462][ T1] unittest-gpio testcase-data:overlay-node:test-bus:gpio@0: no pinctrl handle [ 6186.346148][ T1] gpiochip_find_base: found new base at 507 [ 6186.348684][ T1] ================================================================== [ 6186.351563][ T1] BUG: KASAN: null-ptr-deref in device_property_read_string_array+0x40/0xa0 [ 6186.355157][ T1] Read of size 8 at addr 0000000000000570 by task swapper/0/1 [ 6186.358212][ T1] [ 6186.359361][ T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.9.0-rc5-next-20200915-00006-g104c8fe4916b #1 [ 6186.363877][ T1] Hardware name: linux,dummy-virt (DT) [ 6186.366156][ T1] Call trace: [ 6186.367540][ T1] dump_backtrace+0x0/0x320 [ 6186.369446][ T1] show_stack+0x38/0x60 [ 6186.371282][ T1] dump_stack+0x1d4/0x278 [ 6186.373193][ T1] __kasan_report+0x148/0x180 [ 6186.375265][ T1] kasan_report+0x44/0xe0 [ 6186.377168][ T1] __asan_load8+0xbc/0xe0 [ 6186.379069][ T1] device_property_read_string_array+0x40/0xa0 [ 6186.381741][ T1] devprop_gpiochip_set_names.isra.0+0x4c/0x200 [ 6186.384394][ T1] gpiochip_add_data_with_key+0x75c/0xf80 [ 6186.386876][ T1] unittest_gpio_probe+0xf4/0x1e0 [ 6186.389049][ T1] platform_drv_probe+0xac/0x160 [ 6186.391184][ T1] really_probe+0x430/0xaa0 [ 6186.393136][ T1] really_probe_debug+0x3c/0xe0 [ 6186.395238][ T1] driver_probe_device+0x134/0x1c0 [ 6186.397443][ T1] device_driver_attach+0xec/0x180 [ 6186.399639][ T1] __driver_attach+0x1f0/0x220 [ 6186.401718][ T1] bus_for_each_dev+0x104/0x1c0 [ 6186.403796][ T1] driver_attach+0x44/0x60 [ 6186.405731][ T1] bus_add_driver+0x214/0x3c0 [ 6186.407745][ T1] driver_register+0x1a8/0x240 [ 6186.409835][ T1] __platform_driver_register+0x90/0xa0 [ 6186.412207][ T1] of_unittest_overlay_gpio+0x20c/0x7cc [ 6186.414595][ T1] of_unittest_overlay+0x748/0x7c0 [ 6186.416810][ T1] of_unittest+0x148/0x184 [ 6186.418732][ T1] do_one_initcall+0xc4/0x280 [ 6186.420782][ T1] do_initcalls+0x148/0x1ac [ 6186.422758][ T1] kernel_init_freeable+0x158/0x1a0 [ 6186.425023][ T1] kernel_init+0x24/0x1f0 [ 6186.426938][ T1] ret_from_fork+0x10/0x18 [ 6186.428894][ T1] ================================================================== [ 6186.433241][ T1] Unable to handle kernel read from unreadable memory at virtual address 0000000000000570 [ 6186.437207][ T1] Mem abort info: [ 6186.438639][ T1] ESR = 0x96000004 [ 6186.440536][ T1] EC = 0x25: DABT (current EL), IL = 32 bits [ 6186.442791][ T1] SET = 0, FnV = 0 [ 6186.444660][ T1] EA = 0, S1PTW = 0 [ 6186.446233][ T1] Data abort info: [ 6186.447938][ T1] ISV = 0, ISS = 0x00000004 [ 6186.449749][ T1] CM = 0, WnR = 0 [ 6186.451222][ T1] [0000000000000570] user address but active_mm is swapper [ 6186.454000][ T1] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 6186.456422][ T1] Modules linked in: [ 6186.458232][ T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G B W 5.9.0-rc5-next-20200915-00006-g104c8fe4916b #1 [ 6186.462833][ T1] Hardware name: linux,dummy-virt (DT) [ 6186.465170][ T1] pstate: 60400005 (nZCv daif +PAN -UAO BTYPE=--) [ 6186.467910][ T1] pc : device_property_read_string_array+0x40/0xa0 [ 6186.470653][ T1] lr : device_property_read_string_array+0x40/0xa0 [ 6186.473380][ T1] sp : ffff000069827770 [ 6186.475138][ T1] x29: ffff000069827770 x28: ffffa00014a2cc20 [ 6186.477806][ T1] x27: ffff000068794760 x26: ffff000068794800 [ 6186.480444][ T1] x25: ffff000068794000 x24: ffff0000674e1094 [ 6186.483107][ T1] x23: 0000000000000000 x22: 0000000000000000 [ 6186.485794][ T1] x21: ffffa00012d61ca0 x20: ffffa00012d61200 [ 6186.488457][ T1] x19: 0000000000000000 x18: 00000000000014b8 [ 6186.491100][ T1] x17: 00000000000014f8 x16: 0000000000001438 [ 6186.493779][ T1] x15: 00000000f1f1f1f1 x14: 0000000000000003 [ 6186.496405][ T1] x13: 00000000000ca688 x12: ffff80000d304e7b [ 6186.499084][ T1] x11: 1fffe0000d304e7a x10: ffff80000d304e7a [ 6186.501775][ T1] x9 : ffffa00012702b2c x8 : ffff0000698273d7 [ 6186.504409][ T1] x7 : 0000000000000001 x6 : 00007ffff2cfb186 [ 6186.507074][ T1] x5 : 0000000000000000 x4 : dfffa00000000000 [ 6186.509706][ T1] x3 : ffffa000126f85c4 x2 : 0000000000000007 [ 6186.512352][ T1] x1 : ffff00006981c040 x0 : 0000000000000001 [ 6186.515009][ T1] Call trace: [ 6186.516511][ T1] device_property_read_string_array+0x40/0xa0 [ 6186.519155][ T1] devprop_gpiochip_set_names.isra.0+0x4c/0x200 [ 6186.521806][ T1] gpiochip_add_data_with_key+0x75c/0xf80 [ 6186.524294][ T1] unittest_gpio_probe+0xf4/0x1e0 [ 6186.526518][ T1] platform_drv_probe+0xac/0x160 [ 6186.528632][ T1] really_probe+0x430/0xaa0 [ 6186.530600][ T1] really_probe_debug+0x3c/0xe0 [ 6186.532679][ T1] driver_probe_device+0x134/0x1c0 [ 6186.534936][ T1] device_driver_attach+0xec/0x180 [ 6186.537119][ T1] __driver_attach+0x1f0/0x220 [ 6186.539182][ T1] bus_for_each_dev+0x104/0x1c0 [ 6186.541315][ T1] driver_attach+0x44/0x60 [ 6186.543233][ T1] bus_add_driver+0x214/0x3c0 [ 6186.545307][ T1] driver_register+0x1a8/0x240 [ 6186.547373][ T1] __platform_driver_register+0x90/0xa0 [ 6186.549754][ T1] of_unittest_overlay_gpio+0x20c/0x7cc [ 6186.552105][ T1] of_unittest_overlay+0x748/0x7c0 [ 6186.554272][ T1] of_unittest+0x148/0x184 [ 6186.556193][ T1] do_one_initcall+0xc4/0x280 [ 6186.558248][ T1] do_initcalls+0x148/0x1ac [ 6186.560227][ T1] kernel_init_freeable+0x158/0x1a0 [ 6186.562492][ T1] kernel_init+0x24/0x1f0 [ 6186.564395][ T1] ret_from_fork+0x10/0x18 [ 6186.566404][ T1] Code: aa0303f7 97b54003 9115c260 97c3ca39 (f942ba74) [ 6186.569375][ T1] ---[ end trace f489669ae669dad0 ]--- [ 6186.571688][ T1] Kernel panic - not syncing: Oops: Fatal exception [ 6186.574448][ T1] Kernel Offset: disabled [ 6186.576306][ T1] CPU features: 0x0240002,20002004 [ 6186.578453][ T1] Memory Limit: none [ 6186.580215][ T1] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]--- Cheers, Anders [1] http://ix.io/2xDy