* Re: [PATCH net-next] net-next/hinic: fix comparison of a uint16_t type with -1
From: David Miller @ 2017-08-28 23:44 UTC (permalink / raw)
To: aviad.krawczyk; +Cc: linux-kernel, netdev, zhaochen6, colin.king, dan.carpenter
In-Reply-To: <1503855330-84810-1-git-send-email-aviad.krawczyk@huawei.com>
From: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Date: Mon, 28 Aug 2017 01:35:30 +0800
> Remove the search for index of constant buffer size
>
> Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
> Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 0/4] irda: move it to drivers/staging so we can delete it
From: Joe Perches @ 2017-08-28 23:46 UTC (permalink / raw)
To: David Miller, gregkh; +Cc: samuel, netdev, linux-kernel, devel
In-Reply-To: <20170828.164208.1908438929113102094.davem@davemloft.net>
On Mon, 2017-08-28 at 16:42 -0700, David Miller wrote:
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Date: Sun, 27 Aug 2017 17:03:30 +0200
>
> > The IRDA code has long been obsolete and broken. So, to keep people
> > from trying to use it, and to prevent people from having to maintain it,
> > let's move it to drivers/staging/ so that we can delete it entirely from
> > the kernel in a few releases.
>
> No objection, I'll apply this to net-next, thanks Greg.
Still needs an update to MAINTAINERS.
^ permalink raw reply
* Re: [net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2017-08-27
From: David Miller @ 2017-08-28 23:48 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene
In-Reply-To: <20170828001603.75876-1-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sun, 27 Aug 2017 17:15:48 -0700
> This series contains updates to i40e and i40evf only.
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [PATCH net-next v3 0/3] NCSI VLAN Filtering Support
From: David Miller @ 2017-08-28 23:50 UTC (permalink / raw)
To: sam; +Cc: netdev, linux-kernel, openbmc, joel, benh, gwshan, ratagupt
In-Reply-To: <20170828061843.24349-1-sam@mendozajonas.com>
From: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Date: Mon, 28 Aug 2017 16:18:40 +1000
> This series (mainly patch 2) adds VLAN filtering to the NCSI implementation.
> A fair amount of code already exists in the NCSI stack for VLAN filtering but
> none of it is actually hooked up. This goes the final mile and fixes a few
> bugs in the existing code found along the way (patch 1).
>
> Patch 3 adds the appropriate flag and callbacks to the ftgmac100 driver to
> enable filtering as it's a large consumer of NCSI (and what I've been
> testing on).
>
> v3: - Add comment describing change to ncsi_find_filter()
> - Catch NULL in clear_one_vid() from ncsi_get_filter()
> - Simplify state changes when kicking updated channel
Series applied.
^ permalink raw reply
* Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters
From: Alexei Starovoitov @ 2017-08-28 23:56 UTC (permalink / raw)
To: David Ahern; +Cc: netdev, daniel, ast, tj, davem, luto
In-Reply-To: <bb4398e5-55a3-d63e-ac4d-3f9d7e2efc02@gmail.com>
On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote:
>
> The override flag is independent of the recursive flag. If the override
> flag does not allow an override, the attempt to add a new program fails.
> The recursive flag brings an additional constraint: once a cgroup has a
> program with the recursive flag set it is inherited by all descendant
> groups. Attempts to insert a program that changes that flag fails EINVAL.
>
> Start with the root group at $MNT. No program is attached. By default
> override is allowed and recursive is not set.
The above explanation is the reason we need tests for this logic.
The default is the opposite! By default override is _not_ allowed.
> 1. Group $MNT/a is created.
>
> i. Default settings from $MNT are inherited; 'a' has override enabled
> and recursive disabled.
not true, but say the user attached a prog wih override on...
> ii. Program is attached. Override flag is set, recursive flag is not set.
>
> iii. Process in 'a' opens a socket, program attached to 'a' is run.
>
>
> 2. $MNT/a/b is created
>
> i. 'b' inherits the program and settings of 'a' (override enabled,
> recursive disabled).
>
> ii. Process in 'b' opens a socket. Program inherited from 'a' is run.
>
> iii. Non-interesting case for this patch set: attaching a non-recursive
> program to 'b' overrides the inherited one. process opens a socket only
> the 'b' program is run.
>
> iv. Program is attached to 'b', override flag set, recursive flag set.
>
> v. Process in 'b' opens a socket. Program attached to 'b' is run and
> then program from 'a' is run. Recursion stops here since 'a' does not
> have the recursion flag set.
isn't this the problem? Override+non_recurse was set on 'a'.
Now we attached override+recurse on 'b' and suddenly 'a'
will be run like it was 'recursive'?
imo that is counter intuitive to the owner of 'a'.
I think there can be two options:
- if recurse is not set on 'a', all of it descendents should not be allowed
to use recurse flag
- if recurse is not set on 'a', it should not be run
imo the former is cleaner and avoids issues with detach in the middle
> 3. $MNT/a/b/c is created
>
> i. 'c' inherits the settings of 'b' (override is allowed, recursive flag
> is set)
>
> ii. Process in 'c' opens a socket. No program from 'c' exists, so
> nothing is run. Recursion flag is set, so program from 'b' is run, then
> program from 'a' is run. Stop (recursive flag not set on 'a').
also doesn't make sense to me. Both 'b' and 'c' were attached as
override+recurse while 'a' as non-recurse why would it run?
The owner of 'a' attached it as override in the first place,
so it assumed that if descendent wants to override it it can
and the prog 'a' won't be running.
> iii. Attaching a non-recursive program to 'c' fails because it inherited
> the recursive flag from 'b' and that can not be reset by a descendant.
that part makes sense
> iv. Recursive program is attached to 'c'
>
> v. Process in 'c' opens a socket. Program attached to 'c' is run, then
> the program from 'b' and the program from 'a'. Stop.
>
> etc.
>
> To consider what happens on doubling back and changing programs in the
> hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a',
> recursive on 'b' and recursive on 'c') for each of the following cases:
>
> 1. Program attached to 'b' is detached, recursive flag is reset in the
> request. Attempt fails EINVAL because the recursion flag has to be set.
didn't get this point. you mean 'detach' will fail?
> 2. Program attached to 'b' is detached, recursive flag is set. Allowed.
meaing that detach from 'b' has to pass recurse flag to be detached?
That's also odd.
imo detach should always succeed and the process doing detach
shouldn't need to know what flags were used in attach.
> Process in 'b' opens a socket. No program attached to 'b' so no program
> is run. Recursive flag is set to program from 'a' is run. Stop.
>
> We should allow the recursive flag to be reset if the parent is not
> recursive allowing an unwind of settings applied. I'll add that change.
I don't get this part.
Anyway looking forward to the next patch set with tests and comments like above.
Also adding Andy to cc. I'd really like both Andy and Tejun to review this logic.
^ permalink raw reply
* Re: [PATCH net-next 00/11] bnxt_en: Updates.
From: David Miller @ 2017-08-28 23:57 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
In-Reply-To: <1503942035-24924-1-git-send-email-michael.chan@broadcom.com>
From: Michael Chan <michael.chan@broadcom.com>
Date: Mon, 28 Aug 2017 13:40:24 -0400
> Various changes including updated firmware interface, improved TX ring
> allocation scheme, improved out-of-memory logic in NAPI loop, reduced
> default rings on multi-port devices, new PCI IDs. Of particular note,
>
> CPU affinity hints from Vasundhara Volam.
>
> TC Flower eswitch support from Sathya Perla.
Looks good, series applied, thanks!
^ permalink raw reply
* [RESEND PATCH] Allow passing tid or pid in SCM_CREDENTIALS without CAP_SYS_ADMIN
From: Prakash Sangappa @ 2017-08-29 0:12 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: davem, ebiederm, drepper, prakash.sangappa
Currently passing tid(gettid(2)) of a thread in struct ucred in
SCM_CREDENTIALS message requires CAP_SYS_ADMIN capability otherwise
it fails with EPERM error. Some applications deal with thread id
of a thread(tid) and so it would help to allow tid in SCM_CREDENTIALS
message. Basically, either tgid(pid of the process) or the tid of
the thread should be allowed without the need for CAP_SYS_ADMIN capability.
SCM_CREDENTIALS will be used to determine the global id of a process or
a thread running inside a pid namespace.
This patch adds necessary check to accept tid in SCM_CREDENTIALS
struct ucred.
Signed-off-by: Prakash Sangappa <prakash.sangappa@oracle.com>
---
net/core/scm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/scm.c b/net/core/scm.c
index b1ff8a4..9274197 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -55,6 +55,7 @@ static __inline__ int scm_check_creds(struct ucred *creds)
return -EINVAL;
if ((creds->pid == task_tgid_vnr(current) ||
+ creds->pid == task_pid_vnr(current) ||
ns_capable(task_active_pid_ns(current)->user_ns, CAP_SYS_ADMIN)) &&
((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) ||
uid_eq(uid, cred->suid)) || ns_capable(cred->user_ns, CAP_SETUID)) &&
--
2.7.4
^ permalink raw reply related
* [PATCH net] net: dsa: Don't dereference dst->cpu_dp->netdev
From: Florian Fainelli @ 2017-08-29 0:10 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, dan.carpenter, Florian Fainelli
If we do not have a master network device attached dst->cpu_dp will be
NULL and accessing cpu_dp->netdev will create a trace similar to the one
below. The correct check is on dst->cpu_dp period.
[ 1.004650] DSA: switch 0 0 parsed
[ 1.008078] Unable to handle kernel NULL pointer dereference at
virtual address 00000010
[ 1.016195] pgd = c0003000
[ 1.018918] [00000010] *pgd=80000000004003, *pmd=00000000
[ 1.024349] Internal error: Oops: 206 [#1] SMP ARM
[ 1.029157] Modules linked in:
[ 1.032228] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
4.13.0-rc6-00071-g45b45afab9bd-dirty #7
[ 1.040772] Hardware name: Broadcom STB (Flattened Device Tree)
[ 1.046704] task: ee08f840 task.stack: ee090000
[ 1.051258] PC is at dsa_register_switch+0x5e0/0x9dc
[ 1.056234] LR is at dsa_register_switch+0x5d0/0x9dc
[ 1.061211] pc : [<c08fb28c>] lr : [<c08fb27c>] psr: 60000213
[ 1.067491] sp : ee091d88 ip : 00000000 fp : 0000000c
[ 1.072728] r10: 00000000 r9 : 00000001 r8 : ee208010
[ 1.077965] r7 : ee2b57b0 r6 : ee2b5780 r5 : 00000000 r4 :
ee208e0c
[ 1.084506] r3 : 00000000 r2 : 00040d00 r1 : 2d1b2000 r0 :
00000016
[ 1.091050] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM
Segment user
[ 1.098199] Control: 32c5387d Table: 00003000 DAC: fffffffd
[ 1.103957] Process swapper/0 (pid: 1, stack limit = 0xee090210)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 6d3c8c0dd88a ("net: dsa: Remove master_netdev and use dst->cpu_dp->netdev")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index c442051d5a55..20bc9c56fca0 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -577,7 +577,7 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst)
return err;
}
- if (!dst->cpu_dp->netdev) {
+ if (!dst->cpu_dp) {
pr_warn("Tree has no master device\n");
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related
* Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters
From: David Ahern @ 2017-08-29 0:43 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: netdev, daniel, ast, tj, davem, luto
In-Reply-To: <20170828235653.jq62menrcfrh5rco@ast-mbp>
On 8/28/17 5:56 PM, Alexei Starovoitov wrote:
> On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote:
>>
>> The override flag is independent of the recursive flag. If the override
>> flag does not allow an override, the attempt to add a new program fails.
>> The recursive flag brings an additional constraint: once a cgroup has a
>> program with the recursive flag set it is inherited by all descendant
>> groups. Attempts to insert a program that changes that flag fails EINVAL.
>>
>> Start with the root group at $MNT. No program is attached. By default
>> override is allowed and recursive is not set.
>
> The above explanation is the reason we need tests for this logic.
> The default is the opposite! By default override is _not_ allowed.
yes, I got that backwards. It's how my programs work since I always add
the OVERRIDE flag ATM.
>
>> 1. Group $MNT/a is created.
>>
>> i. Default settings from $MNT are inherited; 'a' has override enabled
>> and recursive disabled.
>
> not true, but say the user attached a prog wih override on...
exactly.
>
>> ii. Program is attached. Override flag is set, recursive flag is not set.
>>
>> iii. Process in 'a' opens a socket, program attached to 'a' is run.
>>
>>
>> 2. $MNT/a/b is created
>>
>> i. 'b' inherits the program and settings of 'a' (override enabled,
>> recursive disabled).
>>
>> ii. Process in 'b' opens a socket. Program inherited from 'a' is run.
>>
>> iii. Non-interesting case for this patch set: attaching a non-recursive
>> program to 'b' overrides the inherited one. process opens a socket only
>> the 'b' program is run.
>>
>> iv. Program is attached to 'b', override flag set, recursive flag set.
>>
>> v. Process in 'b' opens a socket. Program attached to 'b' is run and
>> then program from 'a' is run. Recursion stops here since 'a' does not
>> have the recursion flag set.
>
> isn't this the problem? Override+non_recurse was set on 'a'.
> Now we attached override+recurse on 'b' and suddenly 'a'
> will be run like it was 'recursive'?
Without 'b', 'a' is run. With 'b' and the recurse flag I am suggesting
the user is saying I want 'b' and then 'a'. ie., the first parent group
without the flag is where we stop.
> imo that is counter intuitive to the owner of 'a'.
> I think there can be two options:
> - if recurse is not set on 'a', all of it descendents should not be allowed
> to use recurse flag
> - if recurse is not set on 'a', it should not be run
If 'a' can be overridden then I don't agree with the first suggestion.
Which means you are suggesting we stop at the last group with the
recursive flag set. That is fine too.
>
> imo the former is cleaner and avoids issues with detach in the middle
>
>> 3. $MNT/a/b/c is created
>>
>> i. 'c' inherits the settings of 'b' (override is allowed, recursive flag
>> is set)
>>
>> ii. Process in 'c' opens a socket. No program from 'c' exists, so
>> nothing is run. Recursion flag is set, so program from 'b' is run, then
>> program from 'a' is run. Stop (recursive flag not set on 'a').
>
> also doesn't make sense to me. Both 'b' and 'c' were attached as
> override+recurse while 'a' as non-recurse why would it run?
> The owner of 'a' attached it as override in the first place,
> so it assumed that if descendent wants to override it it can
> and the prog 'a' won't be running.
same argument as above - the question is where do we stop. My suggestion
and implementation is stopping at the first group without the flag.
As stated all along, descendant groups inherit programs of the parent
marked recurse - not by copying them into the group but by recursion.
>
>> iii. Attaching a non-recursive program to 'c' fails because it inherited
>> the recursive flag from 'b' and that can not be reset by a descendant.
>
> that part makes sense
>
>> iv. Recursive program is attached to 'c'
>>
>> v. Process in 'c' opens a socket. Program attached to 'c' is run, then
>> the program from 'b' and the program from 'a'. Stop.
>>
>> etc.
>>
>> To consider what happens on doubling back and changing programs in the
>> hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a',
>> recursive on 'b' and recursive on 'c') for each of the following cases:
>>
>> 1. Program attached to 'b' is detached, recursive flag is reset in the
>> request. Attempt fails EINVAL because the recursion flag has to be set.
>
> didn't get this point. you mean 'detach' will fail?
Yes, because it tried to reset the flag in the process.
This is something we can make user friendly - the detach succeeds, but
the recurse flag is ignored and the recurse flag in the group is not
reset unless it is the base group with the recurse flag (i.e., the
parent is marked non-recurse).
>
>> 2. Program attached to 'b' is detached, recursive flag is set. Allowed.
>
> meaing that detach from 'b' has to pass recurse flag to be detached?
> That's also odd.
> imo detach should always succeed and the process doing detach
> shouldn't need to know what flags were used in attach.
Then, we agree to make it user friendly and handle resetting the recurse
flag automatically.
>
>> Process in 'b' opens a socket. No program attached to 'b' so no program
>> is run. Recursive flag is set to program from 'a' is run. Stop.
>>
>> We should allow the recursive flag to be reset if the parent is not
>> recursive allowing an unwind of settings applied. I'll add that change.
>
> I don't get this part.
> Anyway looking forward to the next patch set with tests and comments like above.
Per above discussion, you don't want 'a' run since it is not marked
recurse. My last sentence is the user friendly part in resetting the
flag in the cgroup.
^ permalink raw reply
* Re: Permissions for eBPF objects
From: Chenbo Feng @ 2017-08-29 0:47 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Daniel Borkmann, Jeffrey Vander Stoep, Stephen Smalley, netdev,
SELinux, Mickaël Salaün
In-Reply-To: <20170826010330.tuospq5h43fv3tlp@ast-mbp>
On Fri, Aug 25, 2017 at 6:03 PM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Fri, Aug 25, 2017 at 10:07:27PM +0200, Daniel Borkmann wrote:
>> On 08/25/2017 09:52 PM, Chenbo Feng wrote:
>> > On Fri, Aug 25, 2017 at 12:45 PM, Jeffrey Vander Stoep <jeffv@google.com> wrote:
>> > > On Fri, Aug 25, 2017 at 12:26 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> > > > On Fri, 2017-08-25 at 11:01 -0700, Jeffrey Vander Stoep via Selinux
>> > > > wrote:
>> > > > > I’d like to get your thoughts on adding LSM permission checks on BPF
>> > > > > objects.
>
> before reinventing the wheel please take a look at landlock work.
> Everything that was discussed in this thread is covered by it.
> The patches have been in development for more than a year and most of the early
> issues have been resolved.
> It will be presented again during security summit in LA in September.
>
I am not very familiar with landlock lsm, isn't this module also
depend on the lsm hooks to do
the landlock check? If so then adding lsm hooks for eBPF object seems
not conflict with the
work on progress.
^ permalink raw reply
* Re: [PATCH] be2net: Fix some u16 fields appropriately
From: 严海双 @ 2017-08-29 1:04 UTC (permalink / raw)
To: David Miller
Cc: sathya.perla, ajit.khaparde, sriharsha.basavapatna, somnath.kotur,
netdev, linux-kernel
In-Reply-To: <20170828.161924.1286298670313299855.davem@davemloft.net>
> On 2017年8月29日, at 上午7:19, David Miller <davem@davemloft.net> wrote:
>
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Sun, 27 Aug 2017 15:24:45 +0800
>
>> In be_tx_compl_process, frag_index declared as u32, so it's better to
>> declare last_index as u32 also.
>>
>> CC: Ajit Khaparde <ajit.khaparde@broadcom.com>
>> Fixes: b0fd2eb28bd4 ("be2net: Declare some u16 fields as u32 to improve
>> performance")
>> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
>
> That is not a legitimate reason for making this change.
>
>> @@ -255,7 +255,7 @@ struct be_tx_stats {
>> /* Structure to hold some data of interest obtained from a TX CQE */
>> struct be_tx_compl_info {
>> u8 status; /* Completion status */
>> - u16 end_index; /* Completed TXQ Index */
>> + u32 end_index; /* Completed TXQ Index */
>> };
>>
>> struct be_tx_obj {
>
> The ->end_index comes solely from:
>
> txcp->end_index = GET_TX_COMPL_BITS(wrb_index, compl);
>
> Which is precisely a 16-bit value.
>
> I'm not applying this, sorry.
>
Hi David,
The GET_TX_COMPL_BITS comes from amap_get which also returns a 32-bit value:
6 static inline u32 amap_get(void *ptr, u32 dw_offset, u32 mask, u32 offset)
5 {
4 u32 *dw = (u32 *) ptr;
3 return mask & (*(dw + dw_offset) >> offset);
2 }
1
869 #define AMAP_GET_BITS(_struct, field, ptr) \
1 amap_get(ptr, \
2 offsetof(_struct, field)/32, \
3 amap_mask(sizeof(((_struct *)0)->field)), \
4 AMAP_BIT_OFFSET(_struct, field))
^ permalink raw reply
* Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters
From: Alexei Starovoitov @ 2017-08-29 1:12 UTC (permalink / raw)
To: David Ahern; +Cc: netdev, daniel, ast, tj, davem, luto
In-Reply-To: <45102738-365f-d08b-f3cf-9a81683956c4@gmail.com>
On Mon, Aug 28, 2017 at 06:43:42PM -0600, David Ahern wrote:
> On 8/28/17 5:56 PM, Alexei Starovoitov wrote:
> > On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote:
> >>
> >> The override flag is independent of the recursive flag. If the override
> >> flag does not allow an override, the attempt to add a new program fails.
> >> The recursive flag brings an additional constraint: once a cgroup has a
> >> program with the recursive flag set it is inherited by all descendant
> >> groups. Attempts to insert a program that changes that flag fails EINVAL.
> >>
> >> Start with the root group at $MNT. No program is attached. By default
> >> override is allowed and recursive is not set.
> >
> > The above explanation is the reason we need tests for this logic.
> > The default is the opposite! By default override is _not_ allowed.
>
> yes, I got that backwards. It's how my programs work since I always add
> the OVERRIDE flag ATM.
>
> >
> >> 1. Group $MNT/a is created.
> >>
> >> i. Default settings from $MNT are inherited; 'a' has override enabled
> >> and recursive disabled.
> >
> > not true, but say the user attached a prog wih override on...
>
> exactly.
>
> >
> >> ii. Program is attached. Override flag is set, recursive flag is not set.
> >>
> >> iii. Process in 'a' opens a socket, program attached to 'a' is run.
> >>
> >>
> >> 2. $MNT/a/b is created
> >>
> >> i. 'b' inherits the program and settings of 'a' (override enabled,
> >> recursive disabled).
> >>
> >> ii. Process in 'b' opens a socket. Program inherited from 'a' is run.
> >>
> >> iii. Non-interesting case for this patch set: attaching a non-recursive
> >> program to 'b' overrides the inherited one. process opens a socket only
> >> the 'b' program is run.
> >>
> >> iv. Program is attached to 'b', override flag set, recursive flag set.
> >>
> >> v. Process in 'b' opens a socket. Program attached to 'b' is run and
> >> then program from 'a' is run. Recursion stops here since 'a' does not
> >> have the recursion flag set.
> >
> > isn't this the problem? Override+non_recurse was set on 'a'.
> > Now we attached override+recurse on 'b' and suddenly 'a'
> > will be run like it was 'recursive'?
>
> Without 'b', 'a' is run. With 'b' and the recurse flag I am suggesting
> the user is saying I want 'b' and then 'a'. ie., the first parent group
> without the flag is where we stop.
>
> > imo that is counter intuitive to the owner of 'a'.
> > I think there can be two options:
> > - if recurse is not set on 'a', all of it descendents should not be allowed
> > to use recurse flag
> > - if recurse is not set on 'a', it should not be run
>
> If 'a' can be overridden then I don't agree with the first suggestion.
> Which means you are suggesting we stop at the last group with the
> recursive flag set. That is fine too.
>
> >
> > imo the former is cleaner and avoids issues with detach in the middle
> >
> >> 3. $MNT/a/b/c is created
> >>
> >> i. 'c' inherits the settings of 'b' (override is allowed, recursive flag
> >> is set)
> >>
> >> ii. Process in 'c' opens a socket. No program from 'c' exists, so
> >> nothing is run. Recursion flag is set, so program from 'b' is run, then
> >> program from 'a' is run. Stop (recursive flag not set on 'a').
> >
> > also doesn't make sense to me. Both 'b' and 'c' were attached as
> > override+recurse while 'a' as non-recurse why would it run?
> > The owner of 'a' attached it as override in the first place,
> > so it assumed that if descendent wants to override it it can
> > and the prog 'a' won't be running.
>
> same argument as above - the question is where do we stop. My suggestion
> and implementation is stopping at the first group without the flag.
>
> As stated all along, descendant groups inherit programs of the parent
> marked recurse - not by copying them into the group but by recursion.
>
>
> >
> >> iii. Attaching a non-recursive program to 'c' fails because it inherited
> >> the recursive flag from 'b' and that can not be reset by a descendant.
> >
> > that part makes sense
> >
> >> iv. Recursive program is attached to 'c'
> >>
> >> v. Process in 'c' opens a socket. Program attached to 'c' is run, then
> >> the program from 'b' and the program from 'a'. Stop.
> >>
> >> etc.
> >>
> >> To consider what happens on doubling back and changing programs in the
> >> hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a',
> >> recursive on 'b' and recursive on 'c') for each of the following cases:
> >>
> >> 1. Program attached to 'b' is detached, recursive flag is reset in the
> >> request. Attempt fails EINVAL because the recursion flag has to be set.
> >
> > didn't get this point. you mean 'detach' will fail?
>
> Yes, because it tried to reset the flag in the process.
>
> This is something we can make user friendly - the detach succeeds, but
> the recurse flag is ignored and the recurse flag in the group is not
> reset unless it is the base group with the recurse flag (i.e., the
> parent is marked non-recurse).
if we don't reset group flags to default it will be even more difficult
for users to use, since attach with recursive flag + immediate detach sets
some internal flag on the cgroup and user space has no way of
either querying this flag or deleting it.
> >
> >> 2. Program attached to 'b' is detached, recursive flag is set. Allowed.
> >
> > meaing that detach from 'b' has to pass recurse flag to be detached?
> > That's also odd.
> > imo detach should always succeed and the process doing detach
> > shouldn't need to know what flags were used in attach.
>
> Then, we agree to make it user friendly and handle resetting the recurse
> flag automatically.
in that sense yes attach/delete pair should be side-effect free.
> >> Process in 'b' opens a socket. No program attached to 'b' so no program
> >> is run. Recursive flag is set to program from 'a' is run. Stop.
> >>
> >> We should allow the recursive flag to be reset if the parent is not
> >> recursive allowing an unwind of settings applied. I'll add that change.
> >
> > I don't get this part.
> > Anyway looking forward to the next patch set with tests and comments like above.
>
> Per above discussion, you don't want 'a' run since it is not marked
> recurse. My last sentence is the user friendly part in resetting the
> flag in the cgroup.
I'm still not grasping fully the semantics of what you're proposing.
You keep saying that override and recurse flags are indepedent, but
the more we talk the more it's clear that there is a complicated
relationship between them. Like no_override overrules everything, etc.
I'm looking for the simplest to use logic. Not implementation.
Implementation can be complex, but uapi should be as simple to
explain and as simple to understand as possible.
So how about allowing recurse+overide combination only?
All descendents must be recurse+override too and
no program allowed to be set on parent unless it's recurse+override
as well. Then detach anywhere is simple, since all programs in
such chain are always recurse+override.
^ permalink raw reply
* Re: Permissions for eBPF objects
From: Alexei Starovoitov @ 2017-08-29 1:15 UTC (permalink / raw)
To: Chenbo Feng
Cc: Daniel Borkmann, Jeffrey Vander Stoep, Stephen Smalley, netdev,
SELinux, Mickaël Salaün
In-Reply-To: <CAMOXUJ=kiZDEpuBfys0Me4o8wqSymCz+Eu_qdQdOH5+Czzfj8g@mail.gmail.com>
On Mon, Aug 28, 2017 at 05:47:19PM -0700, Chenbo Feng wrote:
> On Fri, Aug 25, 2017 at 6:03 PM, Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> > On Fri, Aug 25, 2017 at 10:07:27PM +0200, Daniel Borkmann wrote:
> >> On 08/25/2017 09:52 PM, Chenbo Feng wrote:
> >> > On Fri, Aug 25, 2017 at 12:45 PM, Jeffrey Vander Stoep <jeffv@google.com> wrote:
> >> > > On Fri, Aug 25, 2017 at 12:26 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> >> > > > On Fri, 2017-08-25 at 11:01 -0700, Jeffrey Vander Stoep via Selinux
> >> > > > wrote:
> >> > > > > I’d like to get your thoughts on adding LSM permission checks on BPF
> >> > > > > objects.
> >
> > before reinventing the wheel please take a look at landlock work.
> > Everything that was discussed in this thread is covered by it.
> > The patches have been in development for more than a year and most of the early
> > issues have been resolved.
> > It will be presented again during security summit in LA in September.
> >
> I am not very familiar with landlock lsm, isn't this module also
> depend on the lsm hooks to do
> the landlock check? If so then adding lsm hooks for eBPF object seems
> not conflict with the
> work on progress.
I see. I got it the other way around. What lsm checks are you proposing?
and why unprivileged_bpf_disabled is not enough?
you want to allow unpriv only for specific user(s) ?
^ permalink raw reply
* RE: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
From: Chris Mi @ 2017-08-29 1:34 UTC (permalink / raw)
To: Jamal Hadi Salim, netdev@vger.kernel.org
Cc: xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
mawilcox@microsoft.com
In-Reply-To: <a562fbec-797f-1cb2-8af5-cce36126aa23@mojatatu.com>
> -----Original Message-----
> From: Jamal Hadi Salim [mailto:jhs@mojatatu.com]
> Sent: Tuesday, August 29, 2017 5:56 AM
> To: Chris Mi <chrism@mellanox.com>; netdev@vger.kernel.org
> Cc: xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> mawilcox@microsoft.com
> Subject: Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
>
> On 17-08-28 02:41 AM, Chris Mi wrote:
> > Currently, all filters with the same priority are linked in a doubly
> > linked list. Every filter should have a unique handle. To make the
> > handle unique, we need to iterate the list every time to see if the
> > handle exists or not when inserting a new filter. It is time-consuming.
> > For example, it takes about 5m3.169s to insert 64K rules.
> >
> > This patch changes cls_flower to use IDR. With this patch, it takes
> > about 0m1.127s to insert 64K rules. The improvement is huge.
> >
> > But please note that in this testing, all filters share the same action.
> > If every filter has a unique action, that is another bottleneck.
> > Follow-up patch in this patchset addresses that.
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
>
> As Cong asked last time - any plans to add to other classifiers?
I think if other classifiers don't need so many items, list is enough for them.
If we change all of them, we need spend a lot of time to test them to make sure
there is no regression. But the benefit is not very big. If a certain classifier
need to change in the future, flower is an example for reference.
-Chris
>
> cheers,
> jamal
^ permalink raw reply
* Re: Permissions for eBPF objects
From: Chenbo Feng @ 2017-08-29 1:44 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Daniel Borkmann, Jeffrey Vander Stoep, Stephen Smalley, netdev,
SELinux, Mickaël Salaün
In-Reply-To: <20170829011545.hjhpmyaerd44r5xo@ast-mbp>
On Mon, Aug 28, 2017 at 6:15 PM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Mon, Aug 28, 2017 at 05:47:19PM -0700, Chenbo Feng wrote:
>> On Fri, Aug 25, 2017 at 6:03 PM, Alexei Starovoitov
>> <alexei.starovoitov@gmail.com> wrote:
>> > On Fri, Aug 25, 2017 at 10:07:27PM +0200, Daniel Borkmann wrote:
>> >> On 08/25/2017 09:52 PM, Chenbo Feng wrote:
>> >> > On Fri, Aug 25, 2017 at 12:45 PM, Jeffrey Vander Stoep <jeffv@google.com> wrote:
>> >> > > On Fri, Aug 25, 2017 at 12:26 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> >> > > > On Fri, 2017-08-25 at 11:01 -0700, Jeffrey Vander Stoep via Selinux
>> >> > > > wrote:
>> >> > > > > I’d like to get your thoughts on adding LSM permission checks on BPF
>> >> > > > > objects.
>> >
>> > before reinventing the wheel please take a look at landlock work.
>> > Everything that was discussed in this thread is covered by it.
>> > The patches have been in development for more than a year and most of the early
>> > issues have been resolved.
>> > It will be presented again during security summit in LA in September.
>> >
>> I am not very familiar with landlock lsm, isn't this module also
>> depend on the lsm hooks to do
>> the landlock check? If so then adding lsm hooks for eBPF object seems
>> not conflict with the
>> work on progress.
>
> I see. I got it the other way around. What lsm checks are you proposing?
> and why unprivileged_bpf_disabled is not enough?
> you want to allow unpriv only for specific user(s) ?
>
Exactly, the proposal patch I am currently working on will add checks
before map creation,
map read, and map modify, since all these functionalities will be
available to all users when
unprivileged_bpf_disabled is turned off. And eBPF prog_load may also
need a check as well
since loading some types of program is not restricted either.
^ permalink raw reply
* Hooking on L4 Level with process information
From: Ravish Kumar @ 2017-08-29 2:04 UTC (permalink / raw)
To: Networking
Hi,
I want to hook tcp/udp packets on L4 Layer and based on process
information , content want to deny or allow packets.
Netfilter provides pre/post Routing hooks but not sure that will be
right place so thought of asking whether my approach is right.
Also how i can get process information whether this packet is send by
this process.
Thoughts /source code reference would be appreciated.
Regards,
Ravish
^ permalink raw reply
* Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters
From: David Ahern @ 2017-08-29 2:22 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: netdev, daniel, ast, tj, davem, luto, David Ahern (gmail)
In-Reply-To: <20170829011213.suddt5hkptaxd4rp@ast-mbp>
On 8/28/17 7:12 PM, Alexei Starovoitov wrote:
>>>> To consider what happens on doubling back and changing programs in the
>>>> hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a',
>>>> recursive on 'b' and recursive on 'c') for each of the following cases:
>>>>
>>>> 1. Program attached to 'b' is detached, recursive flag is reset in the
>>>> request. Attempt fails EINVAL because the recursion flag has to be set.
>>>
>>> didn't get this point. you mean 'detach' will fail?
>>
>> Yes, because it tried to reset the flag in the process.
>>
>> This is something we can make user friendly - the detach succeeds, but
>> the recurse flag is ignored and the recurse flag in the group is not
>> reset unless it is the base group with the recurse flag (i.e., the
>> parent is marked non-recurse).
>
> if we don't reset group flags to default it will be even more difficult
> for users to use, since attach with recursive flag + immediate detach sets
> some internal flag on the cgroup and user space has no way of
> either querying this flag or deleting it.
We have discussed this before -- the need to know which cgroup has a
program and now what is the status of flags. That need is a different
problem than this patch set.
I'll address the reset of the flags below to keep that discussion together.
>
>>>
>>>> 2. Program attached to 'b' is detached, recursive flag is set. Allowed.
>>>
>>> meaing that detach from 'b' has to pass recurse flag to be detached?
>>> That's also odd.
>>> imo detach should always succeed and the process doing detach
>>> shouldn't need to know what flags were used in attach.
>>
>> Then, we agree to make it user friendly and handle resetting the recurse
>> flag automatically.
>
> in that sense yes attach/delete pair should be side-effect free.
>
>>>> Process in 'b' opens a socket. No program attached to 'b' so no program
>>>> is run. Recursive flag is set to program from 'a' is run. Stop.
>>>>
>>>> We should allow the recursive flag to be reset if the parent is not
>>>> recursive allowing an unwind of settings applied. I'll add that change.
>>>
>>> I don't get this part.
>>> Anyway looking forward to the next patch set with tests and comments like above.
>>
>> Per above discussion, you don't want 'a' run since it is not marked
>> recurse. My last sentence is the user friendly part in resetting the
>> flag in the cgroup.
>
> I'm still not grasping fully the semantics of what you're proposing.
> You keep saying that override and recurse flags are indepedent, but
> the more we talk the more it's clear that there is a complicated
> relationship between them. Like no_override overrules everything, etc.
yes, I have said that a few times. Override should block everything in
terms of installing programs. If it is not enabled, the status of the
recurse flag is not relevant at attach / detach time as the call should
fail. So installing a program with the recurse flag only works if
override is allowed.
> I'm looking for the simplest to use logic. Not implementation.
> Implementation can be complex, but uapi should be as simple to
> explain and as simple to understand as possible.
> So how about allowing recurse+overide combination only?
> All descendents must be recurse+override too and
> no program allowed to be set on parent unless it's recurse+override
> as well. Then detach anywhere is simple, since all programs in
> such chain are always recurse+override.
Let's walk through examples based on the new ground rule - recursion
stops at last cgroup with flag set.
Assuming override is allowed ...
${MNT}/a/b/c/d
- 'a' has no program
- 'b' has a program, override allowed, recurse set
- 'c' and 'd' inherit the program from 'b' by recursion, not inheritance
(ie., bpf.effective is not updated with the program from 'b', but the
recurse flag is set on 'c' and 'd').
At this point 'c' and 'd' can ONLY take programs that are recursive.
- 'c' gets a program installed
- 'd' gets a program installed.
Process in 'd' has programs run in this order: 'd', 'c', 'b'
Now, program 'c' is detached. It is in the middle of the recursive set.
It MUST keep the recurse flag set as it inherited the restriction from
'b'. The recurse flag on 'c' can ONLY be reset when the program is
detached from 'b' as it is the start of the recursive chain.
I'll stop here to make sure we agree on the above. Considering all
permutations is a maze.
###
Also, let's agree on this intention. Based on the new ground rule, I
want to point out this example:
If 'a' gets a program installed with no recurse flag set, ONLY processes
in 'a' have the 'a' program run. Processes in groups 'b', 'c' and 'd'
all stop at cgroup 'b' program.
To me this is counterintuitive and why I said programs are run up to the
first parent without the recurse flag. They are all part of the same tree.
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2017-08-29 2:25 UTC (permalink / raw)
To: David Miller, Networking
Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
Antoine Tenart, Thomas Petazzoni
Hi all,
Today's linux-next merge of the net-next tree got a conflict in:
drivers/net/ethernet/marvell/mvpp2.c
between commit:
4c2286826451 ("net: mvpp2: fix the mac address used when using PPv2.2")
from the net tree and commits:
09f8397553a2 ("net: mvpp2: introduce per-port nrxqs/ntxqs variables")
213f428f5056 ("net: mvpp2: add support for TX interrupts and RX queue distribution modes")
from the net-next tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc drivers/net/ethernet/marvell/mvpp2.c
index 4d598ca8503a,fea9ae5b70ba..000000000000
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@@ -6504,7 -7248,9 +7248,9 @@@ static int mvpp2_port_probe(struct plat
struct resource *res;
const char *dt_mac_addr;
const char *mac_from;
- char hw_mac_addr[ETH_ALEN];
+ char hw_mac_addr[ETH_ALEN] = {0};
+ unsigned int ntxqs, nrxqs;
+ bool has_tx_irqs;
u32 id;
int features;
int phy_mode;
^ permalink raw reply
* RE: [PATCH] vsock: only load vmci transport on VMware hypervisor by default
From: Dexuan Cui @ 2017-08-29 2:36 UTC (permalink / raw)
To: 'Jorgen S. Hansen', 'Stefan Hajnoczi'
Cc: 'davem@davemloft.net', 'netdev@vger.kernel.org',
'gregkh@linuxfoundation.org',
'devel@linuxdriverproject.org', KY Srinivasan,
Haiyang Zhang, Stephen Hemminger, 'George Zhang',
'Michal Kubecek', 'Asias He',
'Vitaly Kuznetsov', 'Cathy Avery',
'jasowang@redhat.com', 'Rolf Neugebauer',
'Dave Scott', 'Marcelo Cerri',
'apw@canonical.com', "'
In-Reply-To: <KL1P15301MB000812AD1EFB8A3986EC6277BF850@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>
> From: Dexuan Cui
> Sent: Tuesday, August 22, 2017 21:21
> > ...
> > ...
> > The only problem here would be the potential for a guest and a host app
> to
> > have a conflict wrt port numbers, even though they would be able to
> > operate fine, if restricted to their appropriate transport.
> >
> > Thanks,
> > Jorgen
>
> Hi Jorgen, Stefan,
> Thank you for the detailed analysis!
> You have a much better understanding than me about the complex
> scenarios. Can you please work out a patch? :-)
Hi Jorgen, Stefan,
May I know your plan for this?
> IMO Linux driver of Hyper-V sockets is the simplest case, as we only have
> the "to host" option (the host side driver of Hyper-V sockets runs on
> Windows kernel and I don't think the other hypervisors emulate
> the full Hyper-V VMBus 4.0, which is required to support Hyper-V sockets).
>
> -- Dexuan
Thanks,
-- Dexuan
^ permalink raw reply
* [net-next:master 1466/1469] drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:48:10: error: implicit declaration of function 'bnxt_vf_rep_get_fid'
From: kbuild test robot @ 2017-08-29 2:49 UTC (permalink / raw)
To: Sathya Perla; +Cc: kbuild-all, netdev, Michael Chan
[-- Attachment #1: Type: text/plain, Size: 6897 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: acae4b48856838d71d548ab6610a99d8e32653e4
commit: 2ae7408fedfee979e01ed3801223c632bb124c46 [1466/1469] bnxt_en: bnxt: add TC flower filter offload support
config: x86_64-randconfig-b0-08290613 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 2ae7408fedfee979e01ed3801223c632bb124c46
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: In function 'bnxt_flow_get_dst_fid':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:48:10: error: implicit declaration of function 'bnxt_vf_rep_get_fid' [-Werror=implicit-function-declaration]
return bnxt_vf_rep_get_fid(dev);
^~~~~~~~~~~~~~~~~~~
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/timer.h:4,
from include/linux/netdevice.h:28,
from drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c:10:
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c: At top level:
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:390:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:380:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:378:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:369:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:367:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:358:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:356:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:348:2: note: in expansion of macro 'if'
if (p_size < size || q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:345:3: note: in expansion of macro 'if'
if (q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:343:3: note: in expansion of macro 'if'
vim +/bnxt_vf_rep_get_fid +48 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
30
31 /* Return the dst fid of the func for flow forwarding
32 * For PFs: src_fid is the fid of the PF
33 * For VF-reps: src_fid the fid of the VF
34 */
35 static u16 bnxt_flow_get_dst_fid(struct bnxt *pf_bp, struct net_device *dev)
36 {
37 struct bnxt *bp;
38
39 /* check if dev belongs to the same switch */
40 if (!switchdev_port_same_parent_id(pf_bp->dev, dev)) {
41 netdev_info(pf_bp->dev, "dev(ifindex=%d) not on same switch",
42 dev->ifindex);
43 return BNXT_FID_INVALID;
44 }
45
46 /* Is dev a VF-rep? */
47 if (dev != pf_bp->dev)
> 48 return bnxt_vf_rep_get_fid(dev);
49
50 bp = netdev_priv(dev);
51 return bp->pf.fw_fid;
52 }
53
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29938 bytes --]
^ permalink raw reply
* Re: [patch net-next 11/12] mlxsw: spectrum_dpipe: Add support for IPv4 host table dump
From: David Ahern @ 2017-08-29 2:57 UTC (permalink / raw)
To: Arkadi Sharshevsky, Jiri Pirko, netdev
Cc: davem, idosch, mlxsw, roopa, Shrijeet Mukherjee
In-Reply-To: <ee012822-1080-fb83-bd8a-72053162d359@mellanox.com>
On 8/27/17 2:31 AM, Arkadi Sharshevsky wrote:
>> Also, this dpipe capability seems to be just dumping data structures
>> maintained by the driver. ie., you can compare the mlxsw view of
>> networking state to IPv4 and IPv6 level tables. Any plans to offer a
>> command that reads data from the h/w and passes that back to the user?
>> i.e, a command to compare kernel tables to h/w state?
>>
>
> So this infra should provide several things-
>
> 1) Reveal the interactions between various hardware tables
> 2) Counters for this tables
> 3) Debugabillity
>
> The first two can be achieved right now. Regarding debugabillity, which
> is a bit vague, the current assumption is that the drivers internal data
> structures are synced with hardware (which is no always true), and maybe
> are not synced with the kernel, so this can be achieved right now by
> dumping the internal state of the driver. Furthermore, the counters are
> dumped from the hardware and give the user additional indication.
>
> I completely agree that the hardware should be dumped in order to
> validate the internal data structures are really synced with HW. This
> could be usable for observing data corruptions inside the ASIC and
> various complex bugs.
>
> In order to address that I though about maybe add a flag called
> "validate_hw" so that during the dump the driver<-->hw state could be
> validated.
>
> What do you think about it?
It is not just a matter of dumping hardware state. The data returned by
dump needs to be consistent across platforms and vendors.
If the intent is validating hardware state matches kernel state (ie.,
h/w forwarding matches s/w forwarding), then the hardware state should
be dumped by the driver in a form that parallels kernel state. e.g.,
dump h/w routes, neighbor entries, fdb's in a form and granularity
similar to what is done for kernel tables.
With the recent dpipe changes that allows kernel to driver cache and
kernel to h/w state comparisons.
^ permalink raw reply
* Re: [PATCH net-next 1/3 v9] net: ether: Add support for multiplexing and aggregation type
From: Subash Abhinov Kasiviswanathan @ 2017-08-29 3:00 UTC (permalink / raw)
To: Dan Williams
Cc: netdev, davem, fengguang.wu, jiri, stephen, David.Laight, marcel,
andrew
In-Reply-To: <1503958953.20027.5.camel@redhat.com>
On 2017-08-28 16:22, Dan Williams wrote:
> On Thu, 2017-08-24 at 22:39 -0600, Subash Abhinov Kasiviswanathan
> wrote:
>> Define the multiplexing and aggregation (MAP) ether type 0x00F9. This
>> is needed for receiving data in the MAP protocol like RMNET. This is
>> not an officially registered ID.
>>
>> Signed-off-by: Subash Abhinov Kasiviswanathan <subash
>> +#define ETH_P_MAP 0x00F9 /* Multiplex &
>> aggregation proto*/
>
> Any chance you could name this QUALCOMM_MAP or something like that? Or
> at least update the comment to include that fact.
>
> Dan
>
Hi Dan
Sure, I can add a comment for it.
^ permalink raw reply
* [net-next] be2net: use shift instead of expensive divide
From: Zhang Shengju @ 2017-08-29 3:18 UTC (permalink / raw)
To: sathya.perla, ajit.khaparde, sriharsha.basavapatna, netdev
Replace shift instead of expensive divide.
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 319eee3..e06094f 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2455,7 +2455,7 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
/* For checking the valid bit it is Ok to use either definition as the
* valid bit is at the same position in both v0 and v1 Rx compl */
- if (compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) / 32] == 0)
+ if (compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) >> 5] == 0)
return NULL;
rmb();
@@ -2486,7 +2486,7 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
}
/* As the compl has been parsed, reset it; we wont touch it again */
- compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) / 32] = 0;
+ compl->dw[offsetof(struct amap_eth_rx_compl_v1, valid) >> 5] = 0;
queue_tail_inc(&rxo->cq);
return rxcp;
@@ -2590,7 +2590,7 @@ static struct be_tx_compl_info *be_tx_compl_get(struct be_tx_obj *txo)
struct be_tx_compl_info *txcp = &txo->txcp;
struct be_eth_tx_compl *compl = queue_tail_node(tx_cq);
- if (compl->dw[offsetof(struct amap_eth_tx_compl, valid) / 32] == 0)
+ if (compl->dw[offsetof(struct amap_eth_tx_compl, valid) >> 5] == 0)
return NULL;
/* Ensure load ordering of valid bit dword and other dwords below */
@@ -2600,7 +2600,7 @@ static struct be_tx_compl_info *be_tx_compl_get(struct be_tx_obj *txo)
txcp->status = GET_TX_COMPL_BITS(status, compl);
txcp->end_index = GET_TX_COMPL_BITS(wrb_index, compl);
- compl->dw[offsetof(struct amap_eth_tx_compl, valid) / 32] = 0;
+ compl->dw[offsetof(struct amap_eth_tx_compl, valid) >> 5] = 0;
queue_tail_inc(tx_cq);
return txcp;
}
--
1.8.3.1
^ permalink raw reply related
* Re: Hooking on L4 Level with process information
From: Stephen Hemminger @ 2017-08-29 3:19 UTC (permalink / raw)
To: Ravish Kumar; +Cc: Networking
In-Reply-To: <CAEDnJmJZ1-4DFtjmzDO1US2HCuHYDkcsa+tk8mN3CZ6vcDLbVw@mail.gmail.com>
On Tue, 29 Aug 2017 07:34:51 +0530
Ravish Kumar <ravishk2004@gmail.com> wrote:
> Hi,
>
> I want to hook tcp/udp packets on L4 Layer and based on process
> information , content want to deny or allow packets.
>
> Netfilter provides pre/post Routing hooks but not sure that will be
> right place so thought of asking whether my approach is right.
> Also how i can get process information whether this packet is send by
> this process.
>
> Thoughts /source code reference would be appreciated.
>
> Regards,
> Ravish
There is not a 1:1 relationship between sockets/files and processes.
^ permalink raw reply
* RE: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
From: Chris Mi @ 2017-08-29 3:25 UTC (permalink / raw)
To: Simon Horman
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
mawilcox@microsoft.com
In-Reply-To: <20170828113721.GA14697@vergenet.net>
> -----Original Message-----
> From: Simon Horman [mailto:simon.horman@netronome.com]
> Sent: Monday, August 28, 2017 7:37 PM
> To: Chris Mi <chrism@mellanox.com>
> Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
> xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> mawilcox@microsoft.com
> Subject: Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
>
> On Mon, Aug 28, 2017 at 02:41:16AM -0400, Chris Mi wrote:
> > Currently, all filters with the same priority are linked in a doubly
> > linked list. Every filter should have a unique handle. To make the
> > handle unique, we need to iterate the list every time to see if the
> > handle exists or not when inserting a new filter. It is time-consuming.
> > For example, it takes about 5m3.169s to insert 64K rules.
> >
> > This patch changes cls_flower to use IDR. With this patch, it takes
> > about 0m1.127s to insert 64K rules. The improvement is huge.
>
> Very nice :)
>
> > But please note that in this testing, all filters share the same action.
> > If every filter has a unique action, that is another bottleneck.
> > Follow-up patch in this patchset addresses that.
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> > net/sched/cls_flower.c | 55
> > +++++++++++++++++++++-----------------------------
> > 1 file changed, 23 insertions(+), 32 deletions(-)
> >
> > diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index
> > bd9dab4..3d041d2 100644
> > --- a/net/sched/cls_flower.c
> > +++ b/net/sched/cls_flower.c
>
> ...
>
> > @@ -890,6 +870,7 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> > struct cls_fl_filter *fnew;
> > struct nlattr **tb;
> > struct fl_flow_mask mask = {};
> > + unsigned long idr_index;
> > int err;
> >
> > if (!tca[TCA_OPTIONS])
> > @@ -920,13 +901,21 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> > goto errout;
> >
> > if (!handle) {
> > - handle = fl_grab_new_handle(tp, head);
> > - if (!handle) {
> > - err = -EINVAL;
> > + err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > + 1, 0x80000000, GFP_KERNEL);
> > + if (err)
> > goto errout;
> > - }
> > + fnew->handle = idr_index;
> > + }
> > +
> > + /* user specifies a handle and it doesn't exist */
> > + if (handle && !fold) {
> > + err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > + handle, handle + 1, GFP_KERNEL);
> > + if (err)
> > + goto errout;
> > + fnew->handle = idr_index;
> > }
> > - fnew->handle = handle;
> >
> > if (tb[TCA_FLOWER_FLAGS]) {
> > fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
> > @@ -980,6 +969,8 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> > *arg = fnew;
> >
> > if (fold) {
> > + fnew->handle = handle;
>
> Can it be the case that fold is non-NULL and handle is zero?
> The handling of that case seem to have changed in this patch.
I don't think that could happen. In function tc_ctl_tfilter(),
fl_get() will be called. If handle is zero, fl_get() will return NULL.
That means fold is NULL.
>
> > + idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
> > list_replace_rcu(&fold->list, &fnew->list);
> > tcf_unbind_filter(tp, &fold->res);
> > call_rcu(&fold->rcu, fl_destroy_filter);
> > --
> > 1.8.3.1
> >
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox