git: a4007ae10c8f - main - rnd_elf: add comment explaining the interface

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 12 Dec 2021 14:30:34 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a4007ae10c8ffdd89155b4e0b6665b721d7b0a6c

commit a4007ae10c8ffdd89155b4e0b6665b721d7b0a6c
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-12-09 15:22:54 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-12-12 14:28:38 +0000

    rnd_elf: add comment explaining the interface
    
    Requested and reviewed by:      markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D33359
---
 sys/kern/imgact_elf.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 6fcfef4050bb..7e7d4bdc1647 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -875,6 +875,16 @@ fail:
 	return (error);
 }
 
+/*
+ * Select randomized valid address in the map map, between minv and
+ * maxv, with specified alignment.  The [minv, maxv) range must belong
+ * to the map.  Note that function only allocates the address, it is
+ * up to caller to clamp maxv in a way that the final allocation
+ * length fit into the map.
+ *
+ * Result is returned in *resp, error code indicates that arguments
+ * did not pass sanity checks for overflow and range correctness.
+ */
 static int
 __CONCAT(rnd_, __elfN(base))(vm_map_t map, u_long minv, u_long maxv,
     u_int align, u_long *resp)