Re: svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-11 Thread John Baldwin
On 2/10/20 11:15 AM, Konstantin Belousov wrote:
> On Mon, Feb 10, 2020 at 10:11:43AM -0800, John Baldwin wrote:
>> On 2/9/20 4:10 AM, Konstantin Belousov wrote:
>>> Author: kib
>>> Date: Sun Feb  9 12:10:37 2020
>>> New Revision: 357695
>>> URL: https://svnweb.freebsd.org/changeset/base/357695
>>>
>>> Log:
>>>   Add AT_BSDFLAGS auxv entry.
>>>   
>>>   The intent is to provide bsd-specific flags relevant to interpreter
>>>   and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
>>>   auxv entry.
>>>   
>>>   Use bsdflags to report kernel support for sigfastblock(2).  This
>>>   allows rtld and libthr to safely infer the syscall presence without
>>>   SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
>>>   
>>>   Tested by:pho
>>>   Disscussed with:  cem, emaste, jilles
>>>   Sponsored by: The FreeBSD Foundation
>>>   Differential revision:https://reviews.freebsd.org/D12773
>>
>> I find adding a new auxv type curious.  The MIPS ABI doc says that
>> "bits under the 0xff00 mask are reserved for system semantics".
>> The powerpc and x86-64 docs don't define any bits at all.  In
>> practice I think we are free to use AT_FLAGS however we wish as no
>> use cases of "standard" bits have arisen since AT_FLAGS was first
>> defined.
> 
> So you would prefer to have me used AT_FLAGS for sigfastblock indicator ?
> I am feeling uncomfortable doing that.
> 
> My reasoning, to reformulate it from what I wrote in the commit message,
> is to not pollute neither compilation nor ABI namespace for bsd-specific
> flags.  AT_FLAGS was not touched by anybody and I do not want to open
> it for use, since ABI group my finally find some use for it.

I would bet money the ABI group will never use AT_FLAGS since they haven't
found a use yet.  That said, adding a new auxv vector isn't the end of the
world.  I'll work on a patch to GDB when I get some spare time.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-10 Thread Konstantin Belousov
On Mon, Feb 10, 2020 at 10:11:43AM -0800, John Baldwin wrote:
> On 2/9/20 4:10 AM, Konstantin Belousov wrote:
> > Author: kib
> > Date: Sun Feb  9 12:10:37 2020
> > New Revision: 357695
> > URL: https://svnweb.freebsd.org/changeset/base/357695
> > 
> > Log:
> >   Add AT_BSDFLAGS auxv entry.
> >   
> >   The intent is to provide bsd-specific flags relevant to interpreter
> >   and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
> >   auxv entry.
> >   
> >   Use bsdflags to report kernel support for sigfastblock(2).  This
> >   allows rtld and libthr to safely infer the syscall presence without
> >   SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
> >   
> >   Tested by:pho
> >   Disscussed with:  cem, emaste, jilles
> >   Sponsored by: The FreeBSD Foundation
> >   Differential revision:https://reviews.freebsd.org/D12773
> 
> I find adding a new auxv type curious.  The MIPS ABI doc says that
> "bits under the 0xff00 mask are reserved for system semantics".
> The powerpc and x86-64 docs don't define any bits at all.  In
> practice I think we are free to use AT_FLAGS however we wish as no
> use cases of "standard" bits have arisen since AT_FLAGS was first
> defined.

So you would prefer to have me used AT_FLAGS for sigfastblock indicator ?
I am feeling uncomfortable doing that.

My reasoning, to reformulate it from what I wrote in the commit message,
is to not pollute neither compilation nor ABI namespace for bsd-specific
flags.  AT_FLAGS was not touched by anybody and I do not want to open
it for use, since ABI group my finally find some use for it.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-10 Thread John Baldwin
On 2/9/20 4:10 AM, Konstantin Belousov wrote:
> Author: kib
> Date: Sun Feb  9 12:10:37 2020
> New Revision: 357695
> URL: https://svnweb.freebsd.org/changeset/base/357695
> 
> Log:
>   Add AT_BSDFLAGS auxv entry.
>   
>   The intent is to provide bsd-specific flags relevant to interpreter
>   and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
>   auxv entry.
>   
>   Use bsdflags to report kernel support for sigfastblock(2).  This
>   allows rtld and libthr to safely infer the syscall presence without
>   SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
>   
>   Tested by:  pho
>   Disscussed with:cem, emaste, jilles
>   Sponsored by:   The FreeBSD Foundation
>   Differential revision:  https://reviews.freebsd.org/D12773

I find adding a new auxv type curious.  The MIPS ABI doc says that
"bits under the 0xff00 mask are reserved for system semantics".
The powerpc and x86-64 docs don't define any bits at all.  In
practice I think we are free to use AT_FLAGS however we wish as no
use cases of "standard" bits have arisen since AT_FLAGS was first
defined.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-09 Thread Konstantin Belousov
Author: kib
Date: Sun Feb  9 12:10:37 2020
New Revision: 357695
URL: https://svnweb.freebsd.org/changeset/base/357695

Log:
  Add AT_BSDFLAGS auxv entry.
  
  The intent is to provide bsd-specific flags relevant to interpreter
  and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
  auxv entry.
  
  Use bsdflags to report kernel support for sigfastblock(2).  This
  allows rtld and libthr to safely infer the syscall presence without
  SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
  
  Tested by:pho
  Disscussed with:  cem, emaste, jilles
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D12773

Modified:
  head/sys/kern/imgact_elf.c
  head/sys/sys/elf_common.h
  head/usr.bin/procstat/procstat_auxv.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Sun Feb  9 11:53:37 2020(r357694)
+++ head/sys/kern/imgact_elf.c  Sun Feb  9 12:10:37 2020(r357695)
@@ -183,6 +183,11 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, stack_gap, CTLFLAG
 __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
 ": maximum percentage of main stack to waste on a random gap");
 
+static int __elfN(sigfastblock) = 1;
+SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, sigfastblock,
+CTLFLAG_RWTUN, &__elfN(sigfastblock), 0,
+"enable sigfastblock for new processes");
+
 static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
 
 #definealigned(a, t)   (rounddown2((u_long)(a), sizeof(t)) == 
(u_long)(a))
@@ -1366,6 +1371,8 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *i
AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
if (imgp->sysent->sv_hwcap2 != NULL)
AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
+   AUXARGS_ENTRY(pos, AT_BSDFLAGS, __elfN(sigfastblock) ?
+   ELF_BSDF_SIGFASTBLK : 0);
AUXARGS_ENTRY(pos, AT_NULL, 0);
 
free(imgp->auxargs, M_TEMP);

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Sun Feb  9 11:53:37 2020(r357694)
+++ head/sys/sys/elf_common.h   Sun Feb  9 12:10:37 2020(r357695)
@@ -954,8 +954,9 @@ typedef struct {
 #defineAT_EHDRFLAGS24  /* e_flags field from elf hdr */
 #defineAT_HWCAP25  /* CPU feature flags. */
 #defineAT_HWCAP2   26  /* CPU feature flags 2. */
+#defineAT_BSDFLAGS 27  /* ELF BSD Flags. */
 
-#defineAT_COUNT27  /* Count of defined aux entry types. */
+#defineAT_COUNT28  /* Count of defined aux entry types. */
 
 /*
  * Relocation types.
@@ -1456,5 +1457,6 @@ typedef struct {
 #defineR_X86_64_TLSDESC36
 #defineR_X86_64_IRELATIVE  37
 
+#defineELF_BSDF_SIGFASTBLK 0x0001  /* Kernel supports fast 
sigblock */
 
 #endif /* !_SYS_ELF_COMMON_H_ */

Modified: head/usr.bin/procstat/procstat_auxv.c
==
--- head/usr.bin/procstat/procstat_auxv.c   Sun Feb  9 11:53:37 2020
(r357694)
+++ head/usr.bin/procstat/procstat_auxv.c   Sun Feb  9 12:10:37 2020
(r357695)
@@ -197,6 +197,12 @@ procstat_auxv(struct procstat *procstat, struct kinfo_
prefix, "AT_HWCAP2", (u_long)auxv[i].a_un.a_val);
break;
 #endif
+#ifdef AT_BSDFLAGS
+   case AT_BSDFLAGS:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_BSDFLAGS/%#lx}\n",
+   prefix, "AT_BSDFLAGS", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
default:
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
prefix, auxv[i].a_type, auxv[i].a_un.a_val);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"