public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Kitt <steve@sk2.org>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH 7/9] pkeys.7: Update the example to match glibc
Date: Sat, 8 Jan 2022 15:18:57 +0100	[thread overview]
Message-ID: <20220108151857.4d4454f7@heffalump.sk2.org> (raw)
In-Reply-To: <c520d866-0b71-d756-58f6-f54be3560974@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2339 bytes --]

Hi Alex,

On Sat, 8 Jan 2022 02:59:12 +0100, "Alejandro Colomar (man-pages)"
<alx.manpages@gmail.com> wrote:
> On 1/7/22 17:46, Stephen Kitt wrote:
> > glibc 2.27 introduced support for the pkeys functions, but the glibc
> > versions don't match those declared in the example. Update the example
> > to match glibc, and avoid declaring the functions if glibc is new
> > enough. >
> > Signed-off-by: Stephen Kitt <steve@sk2.org>  
> 
> 
> There are a few problems with the prototypes.
> 
> 
> alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype wrpkru
> alx@ady1:~/src/gnu/glibc$ grep -rn define.wrpkru
> alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_set
> 60:int pkey_set (int __key, unsigned int __access_rights) __THROW;
> alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_mprotect
> 72:int pkey_mprotect (void *__addr, size_t __len, int __prot, int 
> __pkey) __THROW;
> alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_alloc
> 56:int pkey_alloc (unsigned int __flags, unsigned int __access_rights) 
> __THROW;
> alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_free
> 68:int pkey_free (int __key) __THROW;
> 
> 
> As you see above, I couldn't find wrpkru().  Are you sure it exists in 
> glibc?

It doesn’t exist in glibc(), but if we use the glibc version of pkey_set(),
it’s not needed in the example. In glibc, the equivalent function is
pkey_write(), but that’s an implementation detail, it’s not part of the API.

> pkey_mprotect(3) uses 'int' instead of 'unsigned long'.  Would you mind 
> fixind that one too?
> 
> pkey_set(3) uses 'unsigned int' instead of 'unsigned long'.  Please fix 
> that one.
> 
> pkey_free(3) uses 'int' instead of 'unsigned long'.  Would you mind 
> fixing that one too?

Right, I’ll take care of all that.

> BTW, I need to modify grep_glibc_prototype() so that it always prints 
> the file name, even if only one file is passed to grep (adding /dev/null 
> to the file list).
> 
> 
> A part from that, I prefer EXAMPLES to be as simple as possible, so I'd 
> do 2 patches.  One to match the definitions to the glibc ones, and then 
> one commit removing old code, assuming glibc is new enough.  Would you 
> mind sending a subsequent patch to remove everything under #if ... #endif?

Right, will do!

Regards,

Stephen

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-01-08 14:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 16:46 [PATCH 1/9] Add a target to check example programs Stephen Kitt
2022-01-07 16:46 ` [PATCH 2/9] seccomp.2: Use syscall() in the example code Stephen Kitt
2022-01-08  1:18   ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 3/9] inet.3: Switch to _DEFAULT_SOURCE in the example Stephen Kitt
2022-01-08  1:26   ` Alejandro Colomar (man-pages)
2022-01-08  9:06     ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 4/9] matherr.3: Exclude the example from analysis Stephen Kitt
2022-01-08  1:31   ` Alejandro Colomar (man-pages)
2022-01-08  9:12     ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 5/9] mq_notify.3: Add signal.h for SIGEV_THREAD Stephen Kitt
2022-01-08  1:38   ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 6/9] newlocale.3: Use LC_GLOBAL_LOCALE, not ..._HANDLE Stephen Kitt
2022-01-08  1:41   ` Alejandro Colomar (man-pages)
2022-01-08  9:13     ` Jakub Wilk
2022-01-08 17:58       ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 7/9] pkeys.7: Update the example to match glibc Stephen Kitt
2022-01-08  1:59   ` Alejandro Colomar (man-pages)
2022-01-08 14:18     ` Stephen Kitt [this message]
2022-01-08 19:20       ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 8/9] strtok.3: Enable example analysis, fix declaration Stephen Kitt
2022-01-08  2:04   ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 9/9] malloc_info.3: Use intptr_t to store pointers Stephen Kitt
2022-01-08  2:25   ` Alejandro Colomar (man-pages)
2022-01-08 10:30     ` Jakub Wilk
2022-01-08 17:09       ` Stephen Kitt
2022-01-08 19:17       ` Alejandro Colomar (man-pages)
2022-01-08  1:15 ` [PATCH 1/9] Add a target to check example programs Alejandro Colomar (man-pages)
2022-01-08  9:22   ` Stephen Kitt
2022-01-08 19:05     ` Alejandro Colomar (man-pages)
2022-01-08 19:38       ` Alejandro Colomar (man-pages)
2022-01-08  2:02 ` Alejandro Colomar (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220108151857.4d4454f7@heffalump.sk2.org \
    --to=steve@sk2.org \
    --cc=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox