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: <bfd5cc30-f5fd-465a-b2d8-f0b35c018cda@csgroup.eu>
Date: Tue, 24 Sep 2024 16:28:13 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Vincenzo Frascino <vincenzo.frascino@....com>,
 Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
 Linux-Arch <linux-arch@...r.kernel.org>, linux-mm@...ck.org
Cc: Andy Lutomirski <luto@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
 "Jason A . Donenfeld" <Jason@...c4.com>,
 Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
 Naveen N Rao <naveen@...nel.org>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "H. Peter Anvin" <hpa@...or.com>, Theodore Ts'o <tytso@....edu>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH v2 4/8] vdso: Introduce vdso/page.h



Le 24/09/2024 à 16:10, Vincenzo Frascino a écrit :
> 
> 
> On 23/09/2024 17:54, Arnd Bergmann wrote:
>> On Mon, Sep 23, 2024, at 14:19, Vincenzo Frascino wrote:
>>> The VDSO implementation includes headers from outside of the
>>> vdso/ namespace.
>>>
>>> Introduce vdso/page.h to make sure that the generic library
>>> uses only the allowed namespace.
>>>
>>> Cc: Andy Lutomirski <luto@...nel.org>
>>> Cc: Thomas Gleixner <tglx@...utronix.de>
>>> Cc: Jason A. Donenfeld <Jason@...c4.com>
>>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@....com>
>>
>> Thanks for the new version. This looks all good, just some
>> very minor ideas for how to possibly improve the new version:
>>
> 
> Thanks Arnd.
> 
>>> +/* PAGE_SHIFT determines the page size */
>>> +#define PAGE_SHIFT      CONFIG_PAGE_SHIFT
>>> +
>>> +#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
>>> +
>>> +#if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_X86_64)
>>> +#define PAGE_MASK	(~((1 << PAGE_SHIFT) - 1))
>>> +#else
>>> +#define PAGE_MASK	(~(PAGE_SIZE-1))
>>> +#endif
>>
>> I would open-code the CONFIG_PAGE_SHIFT in PAGE_SIZE
>> and PAGE_MASK, just to avoid the extra indirection in the
>> preprocessor. This mainly has the benefit of slightly
>> shorter compiler warnings when all the macros get
>> traced back but can also slightly improve compile speed
>> in case this is used in deeply nested macros.
>>
> 
> I will fix it in the next iteration.
> 
>> Without a comment, the special case for CONFIG_X86_64
>> not very clear, and probably not needed. If you are
>> worried about introducing an architecture specific
>> regression, I would suggest instead explaining the
>> possible issue in the patch description but using the
>> more generic and simpler #ifdef check.
>>
> 
> If I do not add the #ifdef, it does not build. But you are right, I should have
> put a comment in the commit message.
> 
> Regression below:
> 
> drivers/gpu/drm/i915/gt/intel_gt_print.h:29:36: error: format ‘%lx’ expects
> argument of type ‘long unsigned int’, but argument 6 has type ‘u32’ {aka
> ‘unsigned int’} [-Werror=format=]
>     29 |         drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id,
> ##__VA_ARGS__)
>        |                                    ^~~~~~~~
> include/drm/drm_print.h:424:39: note: in definition of macro ‘drm_dev_dbg’
>    424 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
>        |                                       ^~~
> include/drm/drm_print.h:524:33: note: in expansion of macro ‘drm_dbg_driver’
>    524 | #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
>        |                                 ^~~~~~~~~~~~~~
> linux/drivers/gpu/drm/i915/gt/intel_gt_print.h:29:9: note: in expansion of macro
> ‘drm_dbg’
>     29 |         drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id,
> ##__VA_ARGS__)
>        |         ^~~~~~~
> drivers/gpu/drm/i915/gt/intel_gt.c:310:25: note: in expansion of macro ‘gt_dbg’
>    310 |                         gt_dbg(gt, "Unexpected fault\n"
>        |                         ^~~~~~
> 
> I am open to alternative suggestions.
> 


'fault' is an 'u32' and 'mask' should be agnostic so the format should 
be %x not %lx I think:

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index a6c69a706fd7..352ef5e1c615 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -308,7 +308,7 @@ static void gen6_check_faults(struct intel_gt *gt)
  		fault = GEN6_RING_FAULT_REG_READ(engine);
  		if (fault & RING_FAULT_VALID) {
  			gt_dbg(gt, "Unexpected fault\n"
-			       "\tAddr: 0x%08lx\n"
+			       "\tAddr: 0x%08x\n"
  			       "\tAddress space: %s\n"
  			       "\tSource ID: %d\n"
  			       "\tType: %d\n",


Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ