lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 May 2021 16:30:00 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Daniel Latypov <dlatypov@...gle.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...el.com>,
        Trent Piepho <tpiepho@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        andy@...nel.org, Andrew Morton <akpm@...ux-foundation.org>,
        Oskar Schirmer <oskar@...ra.com>, Yiyuan Guo <yguoaz@...il.com>
Subject: Re: [PATCH] lib/math/rational.c: Fix divide by zero

On 5/24/21 3:56 PM, Daniel Latypov wrote:
> On Mon, May 24, 2021 at 3:04 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>>
>> On 5/24/21 9:55 AM, Daniel Latypov wrote:
>>> diff --git a/lib/math/Kconfig b/lib/math/Kconfig
>>> index f19bc9734fa7..20460b567493 100644
>>> --- a/lib/math/Kconfig
>>> +++ b/lib/math/Kconfig
>>> @@ -15,3 +15,14 @@ config PRIME_NUMBERS
>>>
>>>  config RATIONAL
>>>         bool
>>> +
>>> +config RATIONAL_KUNIT_TEST
>>> +       tristate "KUnit test for rational number support" if !KUNIT_ALL_TESTS
>>> +       # depends on KUNIT && RATIONAL  # this is how it should work, but
>>> +       depends on KUNIT
>>> +       select RATIONAL # I don't grok kconfig enough to know why this
>>
>> Only to set the symbol CONFIG_RATIONAL.
>> Then when 'make' descends into the lib/math/ subdir and looks at its Makefile,
>> it will decide to build the binary rational.o.
>>
>> obj-$(CONFIG_RATIONAL)          += rational.o
>>
> 
> Ack, I understand that much.

Oh! Clearly I misunderstood the problem.

I had to look thru 60 config files before I found one where CONFIG_RATIONAL
was not set.

And I'm still not sure, but I believe that it's because it has to be set
by some other Kconfig entry doing a 'select' on it.

Here are the kconfigs that select it (on i386, where I found it not set):

- COMMON_CLK [=n] && !HAVE_LEGACY_CLK [=n]
- SERIAL_8250_LPSS [=n] && TTY [=n] && HAS_IOMEM [=y] && SERIAL_8250 [=n] && PCI [=n] && (X86 [=y] || COMPILE_TEST [=y])
- SERIAL_8250_MID [=n] && TTY [=n] && HAS_IOMEM [=y] && SERIAL_8250 [=n] && PCI [=n] && (X86 [=y] || COMPILE_TEST [=y])
- SERIAL_IMX [=n] && TTY [=n] && HAS_IOMEM [=y] && (ARCH_MXC || COMPILE_TEST [=y])
- VIDEO_V4L2 [=n] && MEDIA_SUPPORT [=n] && (I2C [=y] || I2C [=y]=n) && VIDEO_DEV [=n]
- SND_SOC_ROCKCHIP_PDM [=n] && SOUND [=n] && !UML && SND [=n] && SND_SOC [=n] && CLKDEV_LOOKUP [=n] && SND_SOC_ROCKCHIP [=n]
- COMMON_CLK_QCOM [=n] && COMMON_CLK [=n] && OF [=y] && (ARCH_QCOM || COMPILE_TEST [=y])

but my test config has none of those enabled, so I cannot set RATIONAL.

I guess the easiest solution is to have KUNIT or some sub-KUNIT test
just select RATIONAL.

> My confusion is why this doesn't work:
> 
> $ ./tools/testing/kunit/kunit.py run --kunitconfig /dev/stdin <<EOF
> CONFIG_KUNIT=y
> CONFIG_RATIONAL=y
> EOF
> ...
> ERROR:root:Provided Kconfig is not contained in validated .config.
> Following fields found in kunitconfig, but not in .config:
> CONFIG_RATIONAL=y
> 
> What it's complaining about is that `make  ARCH=um olddefconfig` is
> leaving CONFIG_RATIONAL=y unset.
> 
> Stripping out kunit.py, it's this:
> 
> $ echo -e 'CONFIG_KUNIT=y\nCONFIG_RATIONAL=y' > .kunit/.config
> $ make ARCH=um olddefconfig O=.kunit
> $ grep RATIONAL .kunit/.config
> 
> I'm not versed in Kconfig enough to know why CONFIG_RATIONAL=y is
> getting removed.
> 
>>
>>> is necessary
>>> +       default KUNIT_ALL_TESTS
>>> +       help
>>> +               This builds unit tests for the rational number support.
>>> +
>>> +               If unsure, say N.


-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ