Message ID | 3f5a7bc467d221543444a268dd1a1fe0@paul-moore.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Paul Moore |
Headers | show |
Series | [GIT,PULL] lsm/lsm-pr-20240105 | expand |
On Fri, 5 Jan 2024 at 15:21, Paul Moore <paul@paul-moore.com> wrote: > > The hightlights of the LSM pull > request are below, but before we get to that I want to mention that I > expect you will hit merge conflicts in the arch-specific syscall > tables as well as in the doc userspace-api documentation index. Some > of these conflicts exist in your tree now (syscall tables), with some > others likely depending on what is submitted from linux-next and the > order in which you merge things. All of the conflicts that I've seen > have been rather trivial and easily resolved, but I wanted to give you > a heads-up; if you want me to resolve any of these let me know. The tooling header file updates by the LSM tree were particularly annoying. Not because the conflicts were hard per se, but because you had done the header files wrong in the first place. Your version of the tooling header files just didn't match the real ones, as you had added your new system calls at the end mindlessly, without noticing that others had *not* done so, so all your tooling header system call number additions were just the wrong numbers entirely. I fixed it up, but it added an extra layer of "this is just annoying". You'd have been better off not touching the tooling headers at all, rather than touch them incorrectly. Linus
The pull request you sent on Fri, 05 Jan 2024 18:21:18 -0500:
> https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git tags/lsm-pr-20240105
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/063a7ce32ddc2c4f2404b0dfd29e60e3dbcdffac
Thank you!
On Tue, Jan 9, 2024 at 4:08 PM Linus Torvalds <torvalds@linux-foundation.org> wrote: > On Fri, 5 Jan 2024 at 15:21, Paul Moore <paul@paul-moore.com> wrote: > > > > The hightlights of the LSM pull > > request are below, but before we get to that I want to mention that I > > expect you will hit merge conflicts in the arch-specific syscall > > tables as well as in the doc userspace-api documentation index. Some > > of these conflicts exist in your tree now (syscall tables), with some > > others likely depending on what is submitted from linux-next and the > > order in which you merge things. All of the conflicts that I've seen > > have been rather trivial and easily resolved, but I wanted to give you > > a heads-up; if you want me to resolve any of these let me know. > > The tooling header file updates by the LSM tree were particularly annoying. > > Not because the conflicts were hard per se, but because you had done > the header files wrong in the first place. > > Your version of the tooling header files just didn't match the real > ones, as you had added your new system calls at the end mindlessly, > without noticing that others had *not* done so, so all your tooling > header system call number additions were just the wrong numbers > entirely. > > I fixed it up, but it added an extra layer of "this is just annoying". > You'd have been better off not touching the tooling headers at all, > rather than touch them incorrectly. Thanks for pulling the changes, I'm sorry the syscall table entries for the LSM syscalls were not how you want to see them, but I'm more than a little confused as to what exactly we did wrong here. A more detailed explanation would be helpful; if there is a doc somewhere that explains the process, feel free to just drop a pointer. I did provide a note in the pull request that based on linux-next there were likely to be some conflicts in the syscall tables, but that was evidently not sufficient, or we just added the syscall tables the wrong way. Your reply makes me believe we added the syscalls to the arch tables the wrong way, but looking at your merge commit and the files themselves (no helpful comments) I don't see anything obvious. Quickly scanning the kernel docs doesn't reveal anything related either, although I might be missing it. The patches also didn't get any comments regarding the syscall tables during review, and aside from the numbering conflicts in linux-next, there were no comments along the lines of "you need to do it this way" there either. I want to do things The Right Way the next time around, but I need some help to understand what that is ... ?
On Wed, 10 Jan 2024 at 11:54, Paul Moore <paul@paul-moore.com> wrote: > > Thanks for pulling the changes, I'm sorry the syscall table entries > for the LSM syscalls were not how you want to see them, but I'm more > than a little confused as to what exactly we did wrong here. Look at commit 5f42375904b0 ("LSM: wireup Linux Security Module syscalls") and notice for example this: --- a/arch/x86/entry/syscalls/syscall_64.tbl +++ b/arch/x86/entry/syscalls/syscall_64.tbl @@ -378,6 +378,9 @@ 454 common futex_wake sys_futex_wake 455 common futex_wait sys_futex_wait 456 common futex_requeue sys_futex_requeue +457 common lsm_get_self_attr sys_lsm_get_self_attr +458 common lsm_set_self_attr sys_lsm_set_self_attr +459 common lsm_list_modules sys_lsm_list_modules Ok, fine - you added your new system calls to the end of the table. Sure, I ended up having to fix them up because the "end of the table" was different by the time I merged your tree, but that wasn't the problem. The problem is here - in the same commit: --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl @@ -375,6 +375,9 @@ 451 common cachestat sys_cachestat 452 common fchmodat2 sys_fchmodat2 453 64 map_shadow_stack sys_map_shadow_stack +454 common lsm_get_self_attr sys_lsm_get_self_attr +455 common lsm_set_self_attr sys_lsm_set_self_attr +456 common lsm_list_modules sys_lsm_list_modules note how you updated the tools copy WITH THE WRONG NUMBERS! You just added them at the end of the table again, and just incremented the numbers, but that was complete nonsense, because the numbers didn't actually match the real system call numbers, because that tools table hadn't been updated for new system calls - because it hadn't needed them. Yeah, our tooling header duplication is annoying, but the old situation where the tooling just used various kernel headers directly and would randomly break when kernel changes were made was even worse. End result: avoid touching the tooling headers - and if you have to, you need to *think* about it. Linus
On Wed, Jan 10, 2024 at 3:22 PM Linus Torvalds <torvalds@linux-foundation.org> wrote: > > On Wed, 10 Jan 2024 at 11:54, Paul Moore <paul@paul-moore.com> wrote: > > > > Thanks for pulling the changes, I'm sorry the syscall table entries > > for the LSM syscalls were not how you want to see them, but I'm more > > than a little confused as to what exactly we did wrong here. > > Look at commit 5f42375904b0 ("LSM: wireup Linux Security Module > syscalls") and notice for example this: > > --- a/arch/x86/entry/syscalls/syscall_64.tbl > +++ b/arch/x86/entry/syscalls/syscall_64.tbl > @@ -378,6 +378,9 @@ > 454 common futex_wake sys_futex_wake > 455 common futex_wait sys_futex_wait > 456 common futex_requeue sys_futex_requeue > +457 common lsm_get_self_attr sys_lsm_get_self_attr > +458 common lsm_set_self_attr sys_lsm_set_self_attr > +459 common lsm_list_modules sys_lsm_list_modules > > Ok, fine - you added your new system calls to the end of the table. > Sure, I ended up having to fix them up because the "end of the table" > was different by the time I merged your tree, but that wasn't the > problem. > > The problem is here - in the same commit: > > --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl > +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl > @@ -375,6 +375,9 @@ > 451 common cachestat sys_cachestat > 452 common fchmodat2 sys_fchmodat2 > 453 64 map_shadow_stack sys_map_shadow_stack > +454 common lsm_get_self_attr sys_lsm_get_self_attr > +455 common lsm_set_self_attr sys_lsm_set_self_attr > +456 common lsm_list_modules sys_lsm_list_modules > > note how you updated the tools copy WITH THE WRONG NUMBERS! > > You just added them at the end of the table again, and just > incremented the numbers, but that was complete nonsense, because the > numbers didn't actually match the real system call numbers, because > that tools table hadn't been updated for new system calls - because it > hadn't needed them. > > Yeah, our tooling header duplication is annoying, but the old > situation where the tooling just used various kernel headers directly > and would randomly break when kernel changes were made was even worse. > > End result: avoid touching the tooling headers - and if you have to, > you need to *think* about it. Thanks for the explanation, when I read your comment about "tools" I was thinking of whatever tooling transforms the arch/**/*.tbl file and not the tools/perf directory. I should have caught the tools/perf mismatch when reviewing the patches from Casey, but I didn't, I'm sorry. My guess is that my mind was just in the "use the next three numbers" due to the lack of syscall number sync across architectures, but who knows. My mistake, I'll make sure it doesn't happen again.
On 1/10/2024 12:58 PM, Paul Moore wrote: > On Wed, Jan 10, 2024 at 3:22 PM Linus Torvalds > <torvalds@linux-foundation.org> wrote: >> On Wed, 10 Jan 2024 at 11:54, Paul Moore <paul@paul-moore.com> wrote: >>> Thanks for pulling the changes, I'm sorry the syscall table entries >>> for the LSM syscalls were not how you want to see them, but I'm more >>> than a little confused as to what exactly we did wrong here. >> Look at commit 5f42375904b0 ("LSM: wireup Linux Security Module >> syscalls") and notice for example this: >> >> --- a/arch/x86/entry/syscalls/syscall_64.tbl >> +++ b/arch/x86/entry/syscalls/syscall_64.tbl >> @@ -378,6 +378,9 @@ >> 454 common futex_wake sys_futex_wake >> 455 common futex_wait sys_futex_wait >> 456 common futex_requeue sys_futex_requeue >> +457 common lsm_get_self_attr sys_lsm_get_self_attr >> +458 common lsm_set_self_attr sys_lsm_set_self_attr >> +459 common lsm_list_modules sys_lsm_list_modules >> >> Ok, fine - you added your new system calls to the end of the table. >> Sure, I ended up having to fix them up because the "end of the table" >> was different by the time I merged your tree, but that wasn't the >> problem. >> >> The problem is here - in the same commit: >> >> --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl >> +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl >> @@ -375,6 +375,9 @@ >> 451 common cachestat sys_cachestat >> 452 common fchmodat2 sys_fchmodat2 >> 453 64 map_shadow_stack sys_map_shadow_stack >> +454 common lsm_get_self_attr sys_lsm_get_self_attr >> +455 common lsm_set_self_attr sys_lsm_set_self_attr >> +456 common lsm_list_modules sys_lsm_list_modules >> >> note how you updated the tools copy WITH THE WRONG NUMBERS! >> >> You just added them at the end of the table again, and just >> incremented the numbers, but that was complete nonsense, because the >> numbers didn't actually match the real system call numbers, because >> that tools table hadn't been updated for new system calls - because it >> hadn't needed them. >> >> Yeah, our tooling header duplication is annoying, but the old >> situation where the tooling just used various kernel headers directly >> and would randomly break when kernel changes were made was even worse. >> >> End result: avoid touching the tooling headers - and if you have to, >> you need to *think* about it. > Thanks for the explanation, when I read your comment about "tools" I > was thinking of whatever tooling transforms the arch/**/*.tbl file and > not the tools/perf directory. I should have caught the tools/perf > mismatch when reviewing the patches from Casey, but I didn't, I'm > sorry. My guess is that my mind was just in the "use the next three > numbers" due to the lack of syscall number sync across architectures, > but who knows. My mistake, I'll make sure it doesn't happen again. No, It's my mistake. I could have asked for help when I found my head spinning from the syscall numbering scheme and its various implications. I will have a look at how it might be improved. Sorry to have mucked it up, and thank you for the explanation.