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]
Message-ID: <31bade75-316c-4f3a-9325-1e347975f93c@redhat.com>
Date: Thu, 22 Feb 2024 17:31:33 +0100
From: David Hildenbrand <david@...hat.com>
To: Matthew Cassell <mcassell411@...il.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/util.c: Added page count to __vm_enough_memory failure
 warning

On 22.02.24 17:24, Matthew Cassell wrote:
> Resending due to plain-text email issue that caused mailing list to get skipped.
> 
> Thank you for the feedback. I agree with you and would prefer to use
> bytes/kbytes. Here are the 2 concerns that led to me keeping it as
> pages:
> 
> 
> 1. Reduce the impact of the patch. Here is the call trace to reach the
> failure warning:
> 
> <… usual mmap() stuff …>
> mmap_region() -> security_enough_memory_mm() -> __vm_enough_memory()
> 
> Within mmap_region(), the length variable originally passed to mmap()
> gets right-shifted to get the page count. My first thought was to add
> an additional an additional argument to security_enough_memory_mm() of
> type unsigned long to keep that variable, but saw a handful of calls
> to it that would have to conform to the change. Not that I do not
> think this debug statement does not warrant that, I felt the less
> impact, the better.
> 
> 
> 2. Concerned about losing bits. When converting back to bytes I was
> worried about the loss of precision and printing that number back to
> users:
> 
> unsigned long bytes_failed = pages << (PAGE_SHIFT);
> 

In which scenario would you imagine that we lose precision? In other 
words, how would someone be able to create a VMA that is larger than 
what we can fit into an unsigned long in bytes?

I'd simply print "pages << PAGE_SHIFT" here and not worry about that :)

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ