<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">
<pre>on 2019/11/12 18:15, Cyril Hrubis wrote:</pre>
</div>
<blockquote type="cite" cite="mid:20191112101512.GB9373@rei.lan">
<pre class="moz-quote-pre" wrap="">Hi!
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">1) Can undefined error be triggered on old kernel if you use ifdef? It seems unnecessary for ifdef method to include lapi header.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Yes. It can be triggered and it should use #if HAVE_DECL_PR_GET_SPECULATION_CTRL instead of #ifdef.
Yes. And we should add more check( such as PR_SET_SECCOMP undefined 2.6.18-398.el5) in m4/ltp-prctl.m4 so that we cannot include lapi header.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">2) Undfined option in glibc doesn't mean that kernel doesn't support it as well.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
options definitions is in linux/prctl.h. For most distributions, I think if it is in supported in kernel-header, it should also been
supported on kernel.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
That is usually the case, but there are cons that I explained in the
previous email.</pre>
</blockquote>
<pre>OK.</pre>
<blockquote type="cite" cite="mid:20191112101512.GB9373@rei.lan">
<pre class="moz-quote-pre" wrap="">
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">IMO, we only test options that kernel supports.
If we test an unsupported option, our case reports EINVAL that will give user a false impression(kernel
supports it, but argument or environment is bad). I think we should check they whether supported before run
(ifdef is a way).
ps: If we test EPERM error(cap is not in PI or PP) of PR_CAP_AMBIENT on old kernel, they will report EINVAL.
So, I think ifdef is needed.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Why don't we check if the specified option is supported by calling it
with correct args?(i.e. don't mix unsupported option up with wrong args).
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">It sounds reasonable. I will try it in verify_prctl function if you and cyril have strong opposition to #if.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Okay, that will work. Calling it with correct parameters in test setup
is 100% correct way how to find out if kernel implements the
functionality.</pre>
</blockquote>
<pre>OK. I will use correct parameters to check whether kernel implements the functionality in setup.
Thanks for your patiently explation.
ps: I will make v5 patch tomorrow.
</pre>
<blockquote type="cite" cite="mid:20191112101512.GB9373@rei.lan">
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</body>
</html>