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: <B4CD0964-4394-4659-AD1B-208EFB950556@zytor.com>
Date: Wed, 9 Apr 2025 23:52:37 -0700
From: Xin Li <xin@...or.com>
To: Molnar Ingo <mingo@...nel.org>
Cc: "Anvin H. Peter" <hpa@...or.com>, linux-kernel@...r.kernel.org,
        Gross Juergen <jgross@...e.com>, Hansen Dave <dave.hansen@...el.com>,
        Torvalds Linus <torvalds@...ux-foundation.org>,
        Zijlstra Peter <peterz@...radead.org>, Petkov Borislav <bp@...en8.de>,
        Gleixner Thomas <tglx@...utronix.de>
Subject: Re: [PATCH 06/20] x86/msr: Standardize on 'u32' MSR indices in <asm/msr.h>

On Apr 9, 2025, at 11:41 PM, Ingo Molnar <mingo@...nel.org> wrote:
>> 
>> not worth it at all?
> 
> No:
> 
> - Using 'const' for input parameter pointers makes sense because it's
>   easy to have a bug like this in a utility function:
> 
>    obj_ptr->val = foo;
> 
>   this has a side effect on the calling context, spreading the local
>   rot, so to speak, corrupting the object not owned by this function.
> 
> - Using 'const' for non-pointer input parameters makes little sense,
>   because the worst a function can do is to corrupt it locally:
> 
>    val_high = foo;
> 
>   ... but this bug won't be able to spread via corrupting objects
>   through a pointer, any bug will be limited to that function.
> 
> So neither the kernel, nor any of the major libraries such as glibc
> will typically use const for non-pointer function parameters, outside
> of very specific exceptions that strengthen the rule.

Thanks for the explanation!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ