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] [day] [month] [year] [list]
Date: Fri, 10 May 2024 16:40:30 +0800
From: Kunwu Chan <kunwu.chan@...mail.com>
To: Sean Christopherson <seanjc@...gle.com>,
 Oliver Upton <oliver.upton@...ux.dev>
Cc: Andrew Jones <ajones@...tanamicro.com>,
 Markus Elfring <Markus.Elfring@....de>, Kunwu Chan <chentao@...inos.cn>,
 linux-kselftest@...r.kernel.org, kvm@...r.kernel.org,
 kernel-janitors@...r.kernel.org,
 Muhammad Usama Anjum <usama.anjum@...labora.com>,
 Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
 LKML <linux-kernel@...r.kernel.org>, Anup Patel <anup@...infault.org>,
 Thomas Huth <thuth@...hat.com>
Subject: Re: [PATCH] KVM: selftests: Add 'malloc' failure check in
 test_vmx_nested_state

Thanks for reply.

On 2024/4/26 00:25, Sean Christopherson wrote:
> On Wed, Apr 24, 2024, Oliver Upton wrote:
>> Hey,
>>
>> On Wed, Apr 24, 2024 at 07:51:44AM -0700, Sean Christopherson wrote:
>>> On Wed, Apr 24, 2024, Andrew Jones wrote:
>>>> On Tue, Apr 23, 2024 at 12:15:47PM -0700, Sean Christopherson wrote:
>>>> ...
>>>>> I almost wonder if we should just pick a prefix that's less obviously connected
>>>>> to KVM and/or selftests, but unique and short.
>>>>>
>>>> How about kvmsft_ ? It's based on the ksft_ prefix of kselftest.h. Maybe
>>>> it's too close to ksft though and would be confusing when using both in
>>>> the same test?
>>> I would prefer something short, and for whatever reason I have a mental block
>>> with ksft.  I always read it as "k soft", which is completely nonsensical :-)
>> I despise brevity in tests, so my strong preference is to use some form
>> of 'namespaced' helper. Perhaps others have better memory than
>> I do, but I'm quick to forget the selftests library and find the more
>> verbose / obvious function names helpful for jogging my memory.
> Hmm, I generally agree, but in this case I think there's value in having the
> names *not* stand out, because they really are uninteresting and would ideally
> blend in.  I can't envision a scenario where we don't want to assert on an OOM,
> i.e. there should never be a need to use a raw malloc(), and so I don't see much
> value in making it obvious that the call sites are doing something special.
>
>>>> I'm not a huge fan of capital letters, but we could also do something like
>>>> MALLOC()/CALLOC().
>>> Hmm, I'm not usually a fan either, but that could actually work quite well in this
>>> case.  It would be quite intuitive, easy to visually parse whereas tmalloc() vs
>>> malloc() kinda looks like a typo, and would more clearly communicate that they're
>>> macros.
>> Ooo, don't leave me out on the bikeshedding! How about TEST_MALLOC() /
>> TEST_CALLOC(). It is vaguely similar to TEST_ASSERT(), which I'd hope
>> would give the impression that an assertion is lurking below.
> Yeah, but it could also give the false impression that the macro does something
> fancier, e.g. this makes me want to peek at TEST_MALLOC() to see what it's doing
>
> 	cpuid = TEST_MALLOC(kvm_cpuid2_size(nr_entries));
>
> whereas this isn't quite enough to pique my curiosity.
>
> 	cpuid = MALLOC(kvm_cpuid2_size(nr_entries));
>
> So I have a slight preference for just MALLOC()/CALLOC(), but I'm also ok with a
> TEST_ prefix, my brain can adapt.  One of those two flavors has my vote.

According to the previous discussion, so which method do we need to use now?

If you have a consensus, if necessary, I can continue to do this work.

We had many different way in selftests to check the null pointer or fail 
state, such as 'ksft_exit_fail_*' 'ASSERT_*' 'CHECK*' or just use if 
statement.

If we add a new macro, whether these old usage should be changed as well.




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ