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]
Message-ID: <a2a7806b-ba53-9f37-938b-d3f48ea217f2@infradead.org>
Date:   Wed, 15 Feb 2023 22:59:35 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Philippe Mathieu-Daudé <philmd@...aro.org>,
        linux-kernel@...r.kernel.org
Cc:     kernel test robot <lkp@...el.com>,
        Dengcheng Zhu <dzhu@...ecomp.com>,
        John Crispin <john@...ozen.org>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        linux-mips@...r.kernel.org, Qais Yousef <qyousef@...alina.io>
Subject: Re: [PATCH] MIPS: vpe-mt: provide a default 'physical_memsize'

Hi,

On 2/13/23 23:40, Philippe Mathieu-Daudé wrote:
> Hi Randy,
> 
> On 14/2/23 02:09, Randy Dunlap wrote:
>> When neither LANTIQ nor MIPS_MALTA is set, 'physical_memsize' is not
>> declared. This causes the build to fail with:
>>
>> mips-linux-ld: arch/mips/kernel/vpe-mt.o: in function `vpe_run':
>> arch/mips/kernel/vpe-mt.c:(.text.vpe_run+0x280): undefined reference to `physical_memsize'
>>
>> Fix this by declaring a 0-value physical_memsize with neither LANTIQ
>> nor MIPS_MALTA is set, like LANTIQ does.
>>
>> Fixes: 1a2a6d7e8816 ("MIPS: APRP: Split VPE loader into separate files.")
>> Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
>> Reported-by: kernel test robot <lkp@...el.com>
>> Link: https://lore.kernel.org/all/202302030625.2g3E98sY-lkp@intel.com/
>> Cc: Dengcheng Zhu <dzhu@...ecomp.com>
>> Cc: John Crispin <john@...ozen.org>
>> Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
>> Cc: linux-mips@...r.kernel.org
>> ---
>> How has this build error not been detected for 10 years?
>>
>>   arch/mips/kernel/vpe-mt.c |    9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff -- a/arch/mips/kernel/vpe-mt.c b/arch/mips/kernel/vpe-mt.c
>> --- a/arch/mips/kernel/vpe-mt.c
>> +++ b/arch/mips/kernel/vpe-mt.c
>> @@ -22,6 +22,15 @@ static int major;
>>   /* The number of TCs and VPEs physically available on the core */
>>   static int hw_tcs, hw_vpes;
>>   +#if !defined(CONFIG_MIPS_MALTA) && !defined(CONFIG_LANTIQ)
>> +/* The 2 above provide their own 'physical_memsize' variable. */
> 
> Which seems dubious. The variable should be defined once, likely in
> arch/mips/kernel/vpe-mt.c, since arch/mips/include/asm/vpe.h declares
> it.

That doesn't work for CONFIG_MIPS_MALTA=y and MIPS_VPE_LOADER is not set.

In the current (before a consolidation patch) code, mti-malta/malta-memory.c declares
'physical_memsize' and malta-dtshim.c uses it (thru an 'extern'), so
MIPS_VPE_LOADER and MIPS_VPE_LOADER_MT are not required to be enabled.

> I'm surprised CONFIG_MIPS_MALTA always links malta-dtshim.o, but
> malta-dtshim.o depends on MIPS_VPE_LOADER_MT, and I can't find a
> CONFIG_MIPS_MALTA -> MIPS_VPE_LOADER_MT Kconfig dep.

Why does malta-dtshim.o depend on MIPS_VPE_LOADER_MT?

MIPS_MALTA selects SUPPORTS_VPE_LOADER and SYS_SUPPORTS_MULTITHREADING
but does not require MIPS_VPE_LOADER or MIPS_VPE_LOADER_MT.
It builds fine with those symbols being enabled (before any patch).

>> +/*
>> + * This is needed by the vpe-mt loader code, just set it to 0 and assume
>> + * that the firmware hardcodes this value to something useful.
>> + */
>> +unsigned long physical_memsize = 0L;
> 
> I agree this is where this variable has be be declared / initialized,
> but having this dependent on CONFIG_MIPS_MALTA/CONFIG_LANTIQ machines
> doesn't seem right.

So far I have been able to consolidate the LANTIQ code into a general
patch, but not MALTA.

>> +#endif
>> +
>>   /* We are prepared so configure and start the VPE... */
>>   int vpe_run(struct vpe *v)
>>   {
> 
> Regards,
> 
> Phil.

Thanks.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ